gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
How do I change this code from deleting the row where there is "Parent" to deleting if the value equals whats In cell B1?
Need to Start in Row 4
Need to Start in Row 4
Code:
Sub DeleteParentRows2()
'Delete Rows that have "Parent" in column B
Dim X As Long, lastrow As Long
Sheets("Children").Activate
lastrow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
For X = lastrow To 1 Step -1
If Cells(X, 2).Value = "Parent" Then Cells(X, 2).Delete Shift:=xlUp
Next X
ActiveSheet.Name = Range("$C$1").Value
End Sub