View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default HowTo add and name 2 wks to wkbk

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

--
Regards,
Tom Ogilvy

"Dan" wrote in message
...
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.