General Ledger
Active Member
- Joined
- Dec 31, 2007
- Messages
- 460
Dear All,
I have VBA to add a new sheet.
However, I get an error if that sheet name already exits.
How can I insert a new sheet and name it without creating a duplicate?
Concatenating a sequence number to the end of the sheet name if the desired name already exits is fine. This would create sheets with names: Entry, Entry 1, Entry 2, etc.
Thanks,
GL
I have VBA to add a new sheet.
Code:
ActiveSheet.Copy Before:=Sheets(1)
ActiveSheet.NAME = "Entry"
However, I get an error if that sheet name already exits.
Run-time error '1004':
Cannot rename a sheet to the same name as another sheet, a referenced object library or a workbook referenced by Visual Basic.
How can I insert a new sheet and name it without creating a duplicate?
Concatenating a sequence number to the end of the sheet name if the desired name already exits is fine. This would create sheets with names: Entry, Entry 1, Entry 2, etc.
Thanks,
GL