PPRuNe Forums - View Single Post - Excel VBA Query
Thread: Excel VBA Query
View Single Post
Old 16th June 2011 | 12:10
  #2 (permalink)  
PhineasC
 
Joined: May 2011
Posts: 56
Likes: 0
From: London
At last I can contribute something of value:

There are two ways of talking to a worksheet in a workbook either by its index:

ActiveWorkbook.Worksheets(1).SaveAs “Title”

Or by its name

ActiveWorkbook.Worksheets(“WorksheetName”).SaveAs “Title”

The worksheets are indexed 1 to n, the 1st worksheet is the leftmost in the viewing pane, if you move Sheet2 in front of Sheet1 it will become worksheets(1)

Equivalently Workbooks("WorkbookName") is preferred to ActiveWorkbook, as it will error rather than do something irreversible to the activeworkbook
PhineasC is offline  
Reply