Harley78
Electrical
- May 8, 2007
- 77
I have created a command button to hide rows.... depending on the cell. However, I am trying to unhide the rows but stuck as to how to achieve this. I also want the button to change names each time you select it. eg. All Data / Main Data. The macro I have thus far is which works great. My apologies if this is repetative...
Private Sub CommandButton1_Click()
Dim LastRow As Long, i As Long
LastRow = Cells(5000, 47).End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 2 Step -1
If Cells(i, 47).Value = "" Then Cells(i, 47).EntireRow.Hidden = True
Next i
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton1_Click()
Dim LastRow As Long, i As Long
LastRow = Cells(5000, 47).End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 2 Step -1
If Cells(i, 47).Value = "" Then Cells(i, 47).EntireRow.Hidden = True
Next i
Application.ScreenUpdating = True
End Sub