gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,345
- Office Version
- 365
- Platform
- Windows
When I run this, its deleting everything in column B - but not deleting its row. I want it to delete the row its on if what's in column B does not match what's in cell B1
Appreciate your time and help!!
Code:
Dim X As Long, lastrow As Long
lastrow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
For X = lastrow To 1 Step -1
If Cells(X, 2).Value <> Range("B1").Value Then Rows(X).Delete
Next X
ActiveSheet.Name = Range("$C$1").Value
Appreciate your time and help!!