Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Click one cell sheet1, display all related recs on sheet2

I have a situation whereby I have one set of records on sheet1 (1 rec per
row) with a different set of records on sheet2. While there is only one
record per client (1 row) on sheet1, there are one or more associated records
on sheet2.
I want to allow the user to click on the key field cell for a record on
sheet1 that will open sheet2 and display only those records (1 or more rows)
with a corresponding key value.
EXAMPLE:

SHEET1 SHEET2
1 1
2 2
3 2
4 2
5 2
3
3
4
5
5
The user clicks "2" on sheet1
This opens sheet2
sheet2 displays those rows with "2" in the key field (4 rows)

Can anyone help me?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 703
Default Click one cell sheet1, display all related recs on sheet2

Hi

The macro below should do it:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set isect = Intersect(Target, Range("A2:A7"))
If Not isect Is Nothing Then
With Sheets("Sheet2")
.Range("A1:A1000").AutoFilter FIeld:=1,
Criteria1:=Target.Value
End With
Sheets("Sheet2").Activate
End If
End Sub

Right click on the tab for sheet1 and select "wiew code" and insert
the code into the codesheet. Change the ranges as desired. Close the
VBA editor and test it.

Regards,
Per


On 17 Dec., 23:29, Ginsu wrote:
I have a situation whereby I have one set of records on sheet1 (1 rec per
row) with a different set of records on sheet2. While there is only one
record per client (1 row) on sheet1, there are one or more associated records
on sheet2.
I want to allow the user to click on the key field cell for a record on
sheet1 that will open sheet2 and display only those records (1 or more rows)
with a corresponding key value.
EXAMPLE:

SHEET1 * * * * * * *SHEET2
1 * * * * * * * * * * * *1
2 * * * * * * * * * * * *2
3 * * * * * * * * * * * *2
4 * * * * * * * * * * * *2
5 * * * * * * * * * * * *2
* * * * * * * * * * * * * 3
* * * * * * * * * * * * * 3
* * * * * * * * * * * * * 4
* * * * * * * * * * * * * 5
* * * * * * * * * * * * * 5
The user clicks "2" on sheet1
This opens sheet2
sheet2 displays those rows with "2" in the key field *(4 rows)

Can anyone help me?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If Sheet1 column is marked complete, display entire row on Sheet2? CDZ Excel Worksheet Functions 1 October 12th 07 08:19 PM
formula-add 2 numbers of cell a1 and a2 of sheet1 ans-b9in sheet2 Anuja Excel Worksheet Functions 1 September 15th 06 06:52 AM
Display Rows From Sheet1 In Sheet2 (Import) Mythran Excel Worksheet Functions 1 March 24th 06 07:40 PM
Combine 3 Columns on Sheet2 to Display in 1 Column on Sheet1 Summer Excel Worksheet Functions 12 June 14th 05 02:56 PM
can i type sheet1 A5 and make it show Sheet2 A6 cell HelpMe Excel Discussion (Misc queries) 1 February 25th 05 01:44 AM


All times are GMT +1. The time now is 04:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"