Mel Smith
Well-known Member
- Joined
- Dec 13, 2005
- Messages
- 1,023
- Office Version
- 365
- Platform
- Windows
One of our community gave me the following code and I have been trying, without success to refine it and make it work. All I'm trying to achieve is to delete any row between (and including) row 4 to 63 when the value in cell c4:c63 is zero. I do not want nor need a copy of the worksheet. I have the macro stored in my personal .xlsb. I have tried 'commenting out various lines, all to no effect.
Sub Delete_Rows()
'
For i = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Worksheets(i).Copy Before:=ThisWorkbook.Worksheets(i)
i = i + 1
For ii = 63 To 4 Step -1
If ThisWorkbook.Worksheets(i).Cells(ii, 3).Value = 0 Then
ThisWorkbook.Worksheets(i).Cells(ii, 3).EntireRow.Delete
End If
Next
Next
End Sub
Thanks for your help.
Mel
Sub Delete_Rows()
'
For i = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Worksheets(i).Copy Before:=ThisWorkbook.Worksheets(i)
i = i + 1
For ii = 63 To 4 Step -1
If ThisWorkbook.Worksheets(i).Cells(ii, 3).Value = 0 Then
ThisWorkbook.Worksheets(i).Cells(ii, 3).EntireRow.Delete
End If
Next
Next
End Sub
Thanks for your help.
Mel