Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
XL 2003, Windows XP. I have a question regarding copying and renaming sheets. Sub Blah() Dim oActiveSheet As Object blah blah blah Sheets("Duplicate").Copy Befo=Sheets("Duplicate") '\ Set oActiveSheet = Sheets("Duplicate(2)").Select Set oActiveSheet = ActiveSheet End Sub The commented line when uncommented does not work. I get a Run-time error '9': Subscript out of range. Yet the next line does work. Why doesn't the commented line work? What did I do incorrectly? It doesn't seem to matter whether or not I have ".Select" appended to the statement. When I copy, there are no other copies of "Duplicate". VBA appears to name the duplicate of "Duplicate" to "Duplicate (2)". So I am puzzled. Thank you. Best regards, Kevin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
What is the maximum number of sheets you can have in xl2003? | Excel Discussion (Misc queries) | |||
Copying format controls - xl2003 | Excel Discussion (Misc queries) | |||
Renaming sheets with the same name after copying into a new workbo | Excel Discussion (Misc queries) | |||
copying and renaming sheets | Excel Programming | |||
Copying and renaming worksheets | Excel Programming |