Link to home
Start Free TrialLog in
Avatar of SQLSearcher
SQLSearcher

asked on

Excel New a worksheet in a macro

Hello Experts Exchange
I have a Excel 2010 spreadsheet that I want a macro to create a new worksheet and give it a name of import.

I have recorded a macro and have the following code;
Sheets.Add After:=Sheets(Sheets.Count)
    'Sheets("Sheet1").Select
    'Sheets("Sheet1").Name = "Import"

Open in new window


However I am running the macro on many different Excel files, and Sheet1 maybe not be the new worksheet name in some files.

Can you provide the code I would need to create a new worksheet and rename it to import, please?

Regards

SQLSearcher

Regards
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SQLSearcher
SQLSearcher

ASKER

Thank you very much for your help.
Rgonzo,

Quick question.... if you fire this Macro multiple of times, will it use the same name followed by the copy number for each new worksheet?

B.