csehz
asked on
VBA Excel - Add sheet and rename
Dear Experts,
I have three lines in a part of a macro which simply add a new sheet and renames it
Sheets.Add
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "Orders"
My problem that sometimes when the macro add a sheet, it is not Sheet4 just Sheet3 for example, and it stops the running. Could you please advise how to do this simplier so maybe in one step adding and renaming? The target would be simply just adding a new sheet as "Orders"
thanks,
I have three lines in a part of a macro which simply add a new sheet and renames it
Sheets.Add
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "Orders"
My problem that sometimes when the macro add a sheet, it is not Sheet4 just Sheet3 for example, and it stops the running. Could you please advise how to do this simplier so maybe in one step adding and renaming? The target would be simply just adding a new sheet as "Orders"
thanks,
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sheets.Add
ActiveSheet.Name = "Orders"
thanks,