LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
JER JER is offline
external usenet poster
 
Posts: 2
Default Naming convention for a variable "Book1" while copying sheets

I have gotten this far in developing a macro for saving
sheets to a new workbook that users will name themselves.
I can not count on the new workbook to be "Book1" all the
time as the user may have one or more new Books (Book1-n)
open and the next book number would be book1-n+1.

So I need to somehow establish a convention to assign a
name to the new book in the following code (in earlier
versions of this saga I was copying only the input cells
to a new book and the solution there was to simply
use "Windows(2)" as the second book. That doesn't work in
this case.)


Sub sheetsavetrialz()
'
'This starts the save process which saves all cells with
required or optional user input in the selected areas to a
new workbook.
'establishes "ps" as the name for the active workbook
ps = ThisWorkbook.Name
Windows(ps).Activate
ActiveWindow.WindowState = xlMinimized

Workbooks.Add
Windows("ps").Activate
Sheets("Environment").Select
Sheets("Environment").Copy Befo=Workbooks
("Book1").Sheets(1)
Windows("ps").Activate
Sheets("CT").Select
Sheets("CT").Copy Befo=Workbooks("Book1").Sheets(1)
....
and on until the desired sheets (selected via a control)
are saved.



THANKS!
JER



 
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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Stop "Book1" from opening from a saved file jcutolo Excel Discussion (Misc queries) 4 July 27th 07 08:08 PM
"Type mismatch" when I try to fill an Array variable with "+" [email protected] Excel Discussion (Misc queries) 1 April 17th 07 01:28 PM
Naming cell ranges, copying formulas for a range & nesting "IF" fu DonF Excel Discussion (Misc queries) 3 October 5th 06 05:47 PM
Why is "History" a "reserved name" while naming Excel worksheets? Pradeep Excel Discussion (Misc queries) 1 June 30th 06 12:55 PM


All times are GMT +1. The time now is 06:01 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"