View Full Version : Switch to second worksheet or add new one
Djblois
06-26-2006, 06:32 AM
I am trying to write code to switch to the second worksheet if there is one and if there isn't a worksheet I would like to add a new sheet. Is this possible?
mdmackillop
06-26-2006, 07:03 AM
Sub AddSheet()
On Error GoTo NewSheet
Sheets(2).Activate
Exit Sub
NewSheet:
Sheets.Add
End Sub
mvidas
06-26-2006, 10:59 AM
Similar to Malcolms, just showing another way to do it:Sub SheetAdd2()
If Sheets.Count = 1 Then Sheets.Add
Sheets(2).Activate
End SubMatt
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.