View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default HowTo add and name 2 wks to wkbk

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

--

HTH

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


"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.