Generic Sheet Names
refer to the sheets by index number eg
sheets(1)
sheets(2)
sheets(3)
the index number is the order in which they were created in the new workbook
sheets(1).name will return a name you can work with
or when you rename your sheets assign it to a variable
sheet1.name = "Yourname"
yourn = sheet1.name
sheets(yourn).range("a1").value = yourn
"ckrogers" wrote:
I'm creating a spreadsheet with a macro to consolidate the data on individual
worksheets. The spreadsheet will be used as a template and copied as required
for different scenarios; the worksheets will then be renamed for specific
part numbers. Is there a way I can identify the worksheets with their
generic names (Sheet1, Sheet2, etc.) in the Visual Basic code of the macro so
they will still work even when the individual sheets are renamed?
|