strongman86
Board Regular
- Joined
- Feb 15, 2017
- Messages
- 115
- Office Version
- 2019
- Platform
- Windows
Lads,
This post relates to my previous one as no one is replying
https://www.mrexcel.com/forum/excel-questions/1054040-vba-runtime-error.html
I need to amend code so row is added. At the moment code only removes row. Million thanks.
Sub test()
Dim cnt, rw As Integer
Dim val As Variant
cnt = Worksheets("Data").Range("B20000").End(xlUp).Row
On Error Resume Next
For rw = cnt To 2 Step -1
val = Empty
val = Application.WorksheetFunction.VLookup(Worksheets("Data").Range("B" & rw).Value, Worksheets("MdProductDataList").Range("B:B"), 1, False)
If val = Empty Then
Worksheets("Data").Rows(rw).Delete
End If
nxt:
Next rw
End Sub
This post relates to my previous one as no one is replying
https://www.mrexcel.com/forum/excel-questions/1054040-vba-runtime-error.html
I need to amend code so row is added. At the moment code only removes row. Million thanks.
Sub test()
Dim cnt, rw As Integer
Dim val As Variant
cnt = Worksheets("Data").Range("B20000").End(xlUp).Row
On Error Resume Next
For rw = cnt To 2 Step -1
val = Empty
val = Application.WorksheetFunction.VLookup(Worksheets("Data").Range("B" & rw).Value, Worksheets("MdProductDataList").Range("B:B"), 1, False)
If val = Empty Then
Worksheets("Data").Rows(rw).Delete
End If
nxt:
Next rw
End Sub