HowTo add and name 2 wks to wkbk

D

Dan

How do I add and name 2 new worksheets to my workbook? I
had previously deleted a worksheet and thought that the
new sheet would be sheet1 but my code error because new
sheet was sheet2. I want to add 2 sheets called "Final"
and "ScrubData".

I had:
Sub InsertWorksheets()
Dim i As Integer

i=Sheet.Count+1

' I error out here
Sheets(i).Add
ActiveSheets.Select
ActiveSheet.Name="Final"

....confused.
Can someone help this newbie? Thanks.
 
B

Bob Phillips

Worksheets.Add.Name = "Final"
Worksheets.Add.Name = "ScrubData"

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
T

Tom Ogilvy

worksheets.Add(After:=Worksheets( _
Worksheets.count)).Name = "Final"
worksheets.Add(After:=Worksheets( _
Worksheets.count)).Name = "ScrubData"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top