Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Filter data
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 |
#2
|
|||
|
|||
Hi Murthy
You can use the change event to run your sub. http://www.cpearson.com/excel/events.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Murthy" wrote in message ... 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 |
#3
|
|||
|
|||
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 "Ron de Bruin" wrote in message ... Hi Murthy You can use the change event to run your sub. http://www.cpearson.com/excel/events.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Murthy" wrote in message ... 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 |
#4
|
|||
|
|||
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 -- Regards Ron de Bruin http://www.rondebruin.nl "Murthy" wrote in message ... 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 "Ron de Bruin" wrote in message ... Hi Murthy You can use the change event to run your sub. http://www.cpearson.com/excel/events.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Murthy" wrote in message ... 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 |
#5
|
|||
|
|||
Ron,
Many thanks .. I will try this code. Regards, Murthy "Ron de Bruin" wrote in message ... 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 -- Regards Ron de Bruin http://www.rondebruin.nl "Murthy" wrote in message ... 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 "Ron de Bruin" wrote in message ... Hi Murthy You can use the change event to run your sub. http://www.cpearson.com/excel/events.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Murthy" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Filter the way data is plotted | Charts and Charting in Excel | |||
Inserting a hyperlink with "Data Filter" on, in Excel | Excel Discussion (Misc queries) | |||
How to make Bullen's FilterCriteria() data refresh real-time? | Excel Discussion (Misc queries) | |||
Running Data Table using an input that triggers DDE linked data | Excel Discussion (Misc queries) | |||
Data Filter - Not all rows in spreadsheet will display in Autofilt | Excel Worksheet Functions |