LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Worksheets Add & Naming

Hi,

I want to duplicate the formulas of a workbook. I want to start with a
different workbook and starting with Sheet2, I want to add an additional 64
sheets. My worksheet name doesn't appear to work.

I am not sure how to properly explain this next part. The internal sheet
numbers might go 1,5,6,7,8...68. Sheets 2-4 were deleted earlier, so when
we go through the loop, XL seems to add internal sheets from where it left
off. Thus, I am forced to deal with Sheet names.

Any assistance with my subroutine you can provide is most appreciated.

Sub DuplicateWorkBook()
Dim iCounter As Integer

For iCounter = 2 To 65
On Error Resume Next
Worksheets("Sheet" & iCounter).Select
If Err.Number < 0 Then
Worksheets.Add.Move after:=Worksheets.Count - 1
'\This next line doesn't seem to work...nothing gets named
Worksheet.Name = "Sheet" & iCounter
Err.Clear
End If
On Error GoTo 0
Next iCounter



'\ I will move this stuff inside the loop once the loop appears to work
correctly
'\ Windows("Book1.xls").Worksheets("Sheet" & iCounter).Cells.Copy
'\ Windows("NewBook.xls").Worksheets("Sheet" & iCounter).Cells.Select
'\ Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
'\ SkipBlanks:=False, Transpose:=False
'\ Range("A1").Select

End Sub


Best regards,
Kevin


 
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
Naming Worksheets LIAMT Excel Worksheet Functions 1 August 21st 05 02:41 PM
Naming worksheets... tojo107 Excel Discussion (Misc queries) 3 April 7th 05 07:29 PM
naming worksheets Shooter Excel Worksheet Functions 1 December 3rd 04 04:09 PM
Naming Worksheets in VBE Don Guillett[_4_] Excel Programming 0 July 18th 03 08:17 PM
Naming Worksheets in VBE Chip Pearson Excel Programming 0 July 18th 03 08:16 PM


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

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

About Us

"It's about Microsoft Excel"