Hello,
I'm new to VB programming, and I'm basically learning as I go along while doing some HR projects for a summer job. Right now I'm working on a gas check payout report for a mine, and I'm trying to make a macro where when you click on this button, all rows are hidden where the "total" cell for that row contains "$0" while all other values are left alone. Conversely, when the button is unclicked, all rows should appear regardless of value.
The Total column is AF, and the rows applicable are 9 through 69. Below is what I've managed so far, and it doesn't work, and I have no idea where I went wrong, or if I'm even on the right track. Any help would be much appreciated.
Sub ToggleButton1()
For RowCnt = 9 To 69
If Cells(RowCnt, AF).Value = "$0" Then
Cells(RowCnt, AF).EntireRow.Hidden = True
Else
Cells(RowCnt, AF).EntireRow.Hidden = False
End If
Next RowCnt
End Sub
Thanks!
Cory
I'm new to VB programming, and I'm basically learning as I go along while doing some HR projects for a summer job. Right now I'm working on a gas check payout report for a mine, and I'm trying to make a macro where when you click on this button, all rows are hidden where the "total" cell for that row contains "$0" while all other values are left alone. Conversely, when the button is unclicked, all rows should appear regardless of value.
The Total column is AF, and the rows applicable are 9 through 69. Below is what I've managed so far, and it doesn't work, and I have no idea where I went wrong, or if I'm even on the right track. Any help would be much appreciated.
Sub ToggleButton1()
For RowCnt = 9 To 69
If Cells(RowCnt, AF).Value = "$0" Then
Cells(RowCnt, AF).EntireRow.Hidden = True
Else
Cells(RowCnt, AF).EntireRow.Hidden = False
End If
Next RowCnt
End Sub
Thanks!
Cory