Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating linked cells within a workbook, from worksheet to workshe | Excel Discussion (Misc queries) | |||
Linked cells and text boxes | Excel Discussion (Misc queries) | |||
0 in linked cells when watched | Excel Worksheet Functions | |||
How do I sort linked cells ? | Excel Discussion (Misc queries) | |||
How to find linked cells | Excel Discussion (Misc queries) |