I have the following spreadsheet
**Columns a-i** A B C D E F **G** H I **Row 1** 003 His Dressing 3305 S4S 0 0 **35** 35 1 **Row 2** 003 His Dressing Bidding 0 0 0 **0** 0 0
I need a macro that will delete row 2 based on cell g being 0, but ignore row 1 as the value in column g is 35.
of course my spreadsheet has multiple rows that have column g with a value of 0, need to delete all the rows in the workbook.
so here is the sub that has an error in it, dont know why.
Sub DeleteRows()
Dim rownum As Long
for rownum 1 to 1000
If Cells(rownum, 1).Value = 0 Then
Rows(rownum).Delete
Next rownum
Cells(rownum, 1).Activate
End Sub
Best Answer
Here it is:
Open Macros with ALT + F11, inser a new module under ThisWorkbook, and paste the code on the right side.