redspanna
Well-known Member
- Joined
- Jul 27, 2005
- Messages
- 1,602
- Office Version
- 365
- Platform
- Windows
Hey all
So I have this code that looks down sheet 1 ,column A and if a match for the stated string is found then the coresponding row is deleted.
How can the code be changed so instead of me adding each 'string' to form part of the code , the code would check down a list held in column A of Sheet3. Each time a match is found to that list then the row is deleted back in sheet 1
thanks in advance
So I have this code that looks down sheet 1 ,column A and if a match for the stated string is found then the coresponding row is deleted.
How can the code be changed so instead of me adding each 'string' to form part of the code , the code would check down a list held in column A of Sheet3. Each time a match is found to that list then the row is deleted back in sheet 1
VBA Code:
Sub DeleteRowWithContents()
Sheets("Sheet1").Select
Last = Cells(Rows.Count, "A").End(xlUp).Row
For I = Last To 1 Step -1
If (Cells(I, "A").Value) = "SALARY" Then
Cells(I, "A").EntireRow.Delete
Else
If (Cells(I, "A").Value) = "WORKING TAX CREDIT" Then
Cells(I, "A").EntireRow.Delete
End If
End If
Next I
End Sub
thanks in advance