Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Switching Between 2 workbooks using VBA
How do you switch between 2 open workbooks using a macro. Both workbooks
would already be open but I need to be able to pick a value from one, then look for it in the 2nd workbook and then repeat. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Switching Between 2 workbooks using VBA
The following gets a value from Book1 and looks for it in Book2:
Sub demo() Dim r1 As Range Dim r2 As Range Set r1 = Workbooks("Book1").Worksheets("Sheet1").Range("A1" ) v = r1.Value Workbooks("Book2").Activate Sheets("Sheet1").Activate For Each r In ActiveSheet.UsedRange If r.Value = v Then MsgBox (r.Address) Exit For End If Next End Sub using Sheet1 in both books -- Gary's Student "Isit Ears" wrote: How do you switch between 2 open workbooks using a macro. Both workbooks would already be open but I need to be able to pick a value from one, then look for it in the 2nd workbook and then repeat. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Switching between Workbooks | Excel Discussion (Misc queries) | |||
Switching between workbooks | Excel Discussion (Misc queries) | |||
switching between workbooks... | Excel Programming | |||
Switching Workbooks in vbscript | Excel Programming | |||
Switching Names Around | Excel Programming |