Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default HowTo add and name 2 wks to wkbk

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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
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.





  #3   Report Post  
Posted to microsoft.public.excel.programming
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.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HowTo: Baseball Calculator? Brandon[_2_] Excel Discussion (Misc queries) 1 July 1st 08 06:13 PM
howto: concat (x1:x3) Marc Hebert New Users to Excel 3 December 15th 06 07:52 PM
Can't Alt Tab from wkbk to wkbk Help! Paulg Excel Discussion (Misc queries) 1 August 15th 06 05:34 PM
HOWTO Replace from Row Don Guillett[_4_] Excel Programming 9 August 24th 03 03:14 PM
HOWTO Replace from Row SolaSig AB Excel Programming 0 August 22nd 03 12:12 PM


All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"