Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default 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.


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
Help with toggling display Tom Excel Discussion (Misc queries) 3 June 28th 09 12:55 PM
toggling jlofritts Excel Worksheet Functions 3 March 7th 06 06:34 PM
Toggling autofit rgarber50 Excel Discussion (Misc queries) 2 September 4th 05 07:40 AM
toggling a chart on and off VILLABILLA Excel Programming 3 February 26th 04 10:25 AM
Toggling one column of AutoFiltering Mike Niemotka Excel Programming 0 August 18th 03 02:16 PM


All times are GMT +1. The time now is 03:51 AM.

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"