run macro when worksheet is selected

C

Carl

I want to find out if it is possible to have a marco run
whenever a worksheet is selected. I have one worksheet
that contains parameters the user can change and another
worksheet that contains the data. I want a macro to
reselect the filter whenever the spreadsheet containing
the data is selected so the paramaters the user selected
will be reflected in the filtered list. I have already
created the filter, I just want a macro to reselect it so
the data reflects the selected parameters. Another
option would be to run the macro when I exit the
parameter worksheet if that is a possibility.
 
R

Ron de Bruin

Hi Carl

You can use this events


Private Sub Worksheet_Activate()

End Sub

Private Sub Worksheet_Deactivate()

End Sub
 
R

Ron de Bruin

Place the code in a Sheet module

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel
 

Ask a Question

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.

Ask a Question

Top