amandeep08
Board Regular
- Joined
- Mar 20, 2011
- Messages
- 130
- Office Version
- 365
I have a macro that will delete rows if Word GROSS found in column G but it is picking data from G1 till G End. I want to amend the macro where the data will be deleted from G4 onwards.
Sub DeleteRowWithContents()
'========================================================================
' DELETES ALL ROWS FROM A2 DOWNWARDS WITH THE WORDs "Gross" IN COLUMN G
'========================================================================
Last = Cells(Rows.Count, "g").End(xlUp).Row
For i = Last To 3 Step -1
If (Cells(i, "g").Value) = "Gross" Then
'Cells(i, "A").EntireRow.ClearContents ' USE THIS TO CLEAR CONTENTS BUT NOT DELETE ROW
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub
Sub DeleteRowWithContents()
'========================================================================
' DELETES ALL ROWS FROM A2 DOWNWARDS WITH THE WORDs "Gross" IN COLUMN G
'========================================================================
Last = Cells(Rows.Count, "g").End(xlUp).Row
For i = Last To 3 Step -1
If (Cells(i, "g").Value) = "Gross" Then
'Cells(i, "A").EntireRow.ClearContents ' USE THIS TO CLEAR CONTENTS BUT NOT DELETE ROW
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub