The line "Set fn = sh2.Range("A:A").Find(Range.Value, , xlValues, xlWhole)" is giving me error "Argument not optional" on "Range.Value".
I want the code to move from last row to the top. Looking at Sheet1's column A's value. Then search for it in Sheet2's A column and if it is there then delete the entire row on Sheet 1. However I cant figure out the syntax/issues or is there better way to rewrite that line?
Thank you!
Full code(Edited):
Sub Isitthere()
Dim c As Long, LR As Long
Dim sh1 As Worksheet, sh2 As Worksheet, fn As Range
Set sh1 = Application.Sheets("Current") 'Edit sheet name
Set sh2 = Application.Sheets("MTD") 'Edit sheet name
LR = sh1.Range("A" & Rows.Count).End(xlUp).Row
For c = LR To 2 Step -1
Set fn = sh2.Range("A:A").Find(sh1.Cells(c, 1).Value, , xlValues, xlWhole)
If Not fn Is Nothing Then
sh1.Cells(c.Row, Columns.Count).EntireRow.Delete
End If
Next c
End Sub
Range.Value
inSet fn = sh2.Range("A:A").Find(Range.Value, , xlValues, xlWhole)
– Our Man in Bananas