Filter data

M

Murthy

I want to filter the data on a sheet, basing on the value in a particular
cell - say A1.

What I have done so far is:
1) I have generated code to filter the list
2) I have provided a pick list in Cell A1
3) I have created a command button, clicking on which will execute the code
I mentioned in step (1) above.

Instead of clicking on the command button each time, is there a way to
filter the list, as soon as the value in Cell A1 is changed? Which event
should I use in my code for that?

Regards,
Murthy
 
M

Murthy

Thanks, Ron.

Do you think Worksheet_Change event will work for me?

But how will I specify in the code that this Worksheet_Change event should
be triggered only when the value in cell A1 changes?

In other words, the filter should not be attempted by the code when the
cells (other than A1) change.

Regards,
Murthy
 
R

Ron de Bruin

Hi Murthy

Use this

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
YourMacroName
End If
End Sub
 

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