Mattster2020
09-18-2009, 04:15 AM
Afternoon All,
I am using the below code to delete rows from a tab in a spreadsheet, the code runs when a users clicks a button, my question is, how would I amend my code below to run for ALL tabs within the spreadsheet?
Private Sub CommandButton1_Click()
Dim lastrow As Long
Dim i As Long
lastrow = Range("A:J").SpecialCells(xlLastCell).Row
Range("E5").Select
i = 1
Do While i < lastrow
If ActiveCell = "0" Then
ActiveCell.EntireRow.Delete shift:=xlUp
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop
End Sub
Any help would be appriecated.
Regards,
Matt
I am using the below code to delete rows from a tab in a spreadsheet, the code runs when a users clicks a button, my question is, how would I amend my code below to run for ALL tabs within the spreadsheet?
Private Sub CommandButton1_Click()
Dim lastrow As Long
Dim i As Long
lastrow = Range("A:J").SpecialCells(xlLastCell).Row
Range("E5").Select
i = 1
Do While i < lastrow
If ActiveCell = "0" Then
ActiveCell.EntireRow.Delete shift:=xlUp
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop
End Sub
Any help would be appriecated.
Regards,
Matt