toggling between 2 workbooks
I'm copying data from one workbook to another. One of them will have a
static file name, example test.xls The other workbook, from which the macro is run, will have a variable name, as it is changed each day, and given a new name based on the date, example test 10-01-06.xls Question is... in my macro, after I open up the other workbook (text.xls), how can I switch control back to the original workbook? Here's what I have so far: 'Opens the workbook w/ the static name Workbooks.Open Filename:= Test.xls" ......more code...... 'Control back to the original workbook. Then activates a worksheet. 'Remember - This workbook's name will change each day, w/ the date as part of the new name. Worksheets("sheet").Activate Thanks, J.O. |
toggling between 2 workbooks
Create a workbook variable and set it to the activeworkbook before opening
the next. Dim wb As Workbook Set wb = ActiveWorkbook Workbooks.Open.... BlahBlahBlah wb.Activate -- Charles Chickering "A good example is twice the value of good advice." "excelnut1954" wrote: I'm copying data from one workbook to another. One of them will have a static file name, example test.xls The other workbook, from which the macro is run, will have a variable name, as it is changed each day, and given a new name based on the date, example test 10-01-06.xls Question is... in my macro, after I open up the other workbook (text.xls), how can I switch control back to the original workbook? Here's what I have so far: 'Opens the workbook w/ the static name Workbooks.Open Filename:= Test.xls" ......more code...... 'Control back to the original workbook. Then activates a worksheet. 'Remember - This workbook's name will change each day, w/ the date as part of the new name. Worksheets("sheet").Activate Thanks, J.O. |
All times are GMT +1. The time now is 09:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com