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
Microsoft DevelopmentMicrosoft ExcelSpreadsheets

Avatar of undefined
Last Comment
Bright01

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SQLSearcher

ASKER
Thank you very much for your help.
Bright01

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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes