LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
flummi
 
Posts: n/a
Default Linked cells with validation

Hi,

here's a proposal that you could test and if suitable adapt to your
needs.

Open your workbook
press Alt-F11 that will open VBA editor
In the left hand list of projects identify your workbook e.g.
VBAProject(Book2)
click the cross in front of it
click "This workbook"
There are 2 listboxes at the top
click the first one and select Workbook
click the second one and select SheetActivate
that will insert 3 lines:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)

End Sub

Copy the following procedure into the empty line before End Sub

For s = 2 To 3
sn = "sheet" + CStr(s)
For k = 1 To 20
Worksheets(sn).Cells(k, 1).Value = ""
Worksheets(sn).Cells(k, 2).Value = ""
Next k
k = 1
For i = 1 To 20
If Worksheets("Sheet1").Cells(i, 1) < "" Then
If Worksheets("Sheet1").Cells(i, 1).Value =
Worksheets(sn).Cells(1, 5).Value Then
Worksheets(sn).Cells(k, 1).Value =
Worksheets("Sheet1").Cells(i, 1)
Worksheets(sn).Cells(k, 2).Value =
Worksheets("Sheet1").Cells(i, 2)
k = k + 1
End If
End If
Next i
Next s

Use this in A1:B6 on sheet1 to test it.
On sheeet 2 put your criteria in E1 on sheet1 and E1 on sheet 3 e.g.
D E
1 chance: b

Data

a 33
b 12
c 22
a 66
e 86
c 33


Everytime you switch to a worksheet the procedure will run and do the
defined selections.
You can also put a button on sheet2, in design mode right click it,
select View Code and copy the procedure before End Sub.
Copy that button onto sheet 3.

When you change your selection criteria and want to run the procedure
press the button

Hans

 
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
Updating linked cells within a workbook, from worksheet to workshe notloiseweiss Excel Discussion (Misc queries) 7 February 18th 08 01:15 AM
Linked cells and text boxes Alexlondon11 Excel Discussion (Misc queries) 2 November 23rd 05 04:10 PM
0 in linked cells when watched steve Excel Worksheet Functions 1 November 22nd 05 05:26 PM
How do I sort linked cells ? karen Excel Discussion (Misc queries) 5 November 12th 05 11:25 PM
How to find linked cells anoop Excel Discussion (Misc queries) 1 November 2nd 05 08:26 AM


All times are GMT +1. The time now is 06:57 AM.

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

About Us

"It's about Microsoft Excel"