If you want to have the command button toggle the rows (each time it is
clicked), you can do
Private Sub CommandButton1_Click()
Dim rng As Range, rng1 As Range
On Error Resume Next
Set rng = Range("AD:AD").SpecialCells(xlBlanks)
Set rng1 = Range("AD:AD").SpecialCells(xlVisible)
On Error GoTo 0
Debug.Print rng.Address
Debug.Print rng1.Address
If Not rng Is Nothing Then
If rng1.Areas.Count = 1 Then
rng.EntireRow.Hidden = True
Else
rng.EntireRow.Hidden = False
End If
End If
End Sub
--
Regards,
Tom Ogilvy
Todd said:
Thank you Tom, I have this set to a command button and it works
wonderfully. Another question about this though. I want to have the button
hide when clicked and unhide if unselected too. How can somethng like this
be done?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.