a little Excel macro help plz

Associate
Joined
9 May 2005
Posts
859
Location
Devon
Hi

I am helping a friend with a spreadsheet as years ago I used to do little VB coding but as ive just realised I have forgotten it all. Its going well apart from the filter reset button. I have made a quick example to show you as I don’t want to show you the original.

filter.jpg


The problem is if you hit the reset filter button, and you haven’t selected a filter you get the run time error which obviously we do not want. At the moment the code for the reset button is

Private Sub ToggleButton1_Click()

ActiveSheet.ShowAllData
End Sub

Private Sub CommandButton1_Click()
ActiveSheet.ShowAllData
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub
.

What can I add to it so you cannot click the button unless a filter has been selected? I know this is simple but I really can’t remember how.

Any help much appreciated

Slackjaw190
 
I thought that is what we did. We can reset the filters but i want to disable the button when a filter is not selected so you cant hit it and get the error. This is annoying cuz i know im missing something simple here
 
Back
Top Bottom