It's actually very easy!

It's called a Selection_Change event.

on the worksheet, right-click on the sheet "tab" name and select View Code.
in the VB Edit window, select the pull-down on the upper left and select 
Worksheet

The default event is the Worksheet_SelectionChange event!
the event gets passed the Range as the varible Target.

I would suggest first checking to see if more than one cell is selected:

If (target.count = 1) then

next, check to see if the selected cell is in the appropriate column:

if (target.column = 4) then
would check to see if the cell is in column "D".

If it could be in a range of cells: use something like:

If (Not Intersect(Range(Target.Address), Range("D2:K50")) Is Nothing) Then

checks to see if the selected cell is in colums D-K
and rows 2 through 50


If these tests are met, then you can call the subroutine that changes to the
data sheet and filters the data based on the Target.Value

let me know if you need further examples.

Paul



________________________________
From: rcamarda <robert.a.cama...@gmail.com>
To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
Sent: Fri, February 4, 2011 10:15:53 AM
Subject: $$Excel-Macros$$ Click on Cell - show filtered data on another sheet

Hi,
I'm not sure if this is possible, so I thought I would cast a wide
net.
Description: I have an Excel spreadsheet with many sheets of summary
and detail information of employees.
On a summary sheet, I have rows that list job titles and the quantity
of employees with that job title in the adjacent cell.
I'd like to click on the summary number, and then change to the detail
sheet that shows just the employees with that job title.
My data is in Tables. I have already programmed setting and clearing
filters and navigating about the sheets, updating SQL, so I could
create a sub that does what I want, but I don't know what to search
about clicking a cell then start the process. Visually I'd like
something simple like a hyperlink.
The part that I don't know if possible is the click on a cell then
have something happen.
TIA
Rob

-- 
----------------------------------------------------------------------------------

Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to