rob_grimshaw
New Member
- Joined
- Jan 18, 2019
- Messages
- 9
Dear all,
I've written some VBA code to
Can you help?
I've written some VBA code to
- find a value in another spreadsheet and
- where that value occurs delete the row in the original
Can you help?
Code:
Sub DeleteRows()
Dim myRange1, v, f, a
Set myRange1 = Columns("a:a")
For Each v In Workbooks("!Exclusion list.xlsx").Worksheets("Clinic codes").ListObjects("Exclusions").ListColumns(1).DataBodyRange
Set f = myRange1.Find(what:=v, lookat:=xlPart)
If Not f Is Nothing Then
a = f.Address
Do
f.EntireRow.Delete
Set f = myRange1.FindNext
Loop While f.Address <> a
End If
Next
End Sub