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: 8
Default worksheet number OutOfRange

Hi!
I create a new workbook (VBScript in Excel 2003) and automatically 3 sheets
are created (Sheet1, Sheet2, Sheet3).
As I run thru the input file, if there's a new client, I want to use a new
Sheet.
Sheet 1 is successfully renamed to clientName (see code below), but when I
want to use the next one, Sheet2, I get an OutOfRange error.

worksheet = 1
Set objWorksheet = objWorkbook.Worksheets(worksheet)
objWorksheet.Name = clientName
lastClientName = clientName

If (clientName < lastClientName)
worksheet = worksheet + 1
Set objWorksheet = objWorkbook.Worksheets(worksheet)
objWorksheet.Name = clientName
End If

 
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
Find a number on another worksheet Heath Excel Worksheet Functions 1 February 12th 09 02:15 AM
Finding the number of a worksheet GeorgeJ Excel Discussion (Misc queries) 2 July 27th 07 09:02 PM
Enter number on a worksheet to copy row from another worksheet 1SG Excel Worksheet Functions 1 May 22nd 07 12:15 AM
Basic Question - How do I return the worksheet number of the active worksheet? Regnab Excel Programming 2 May 17th 06 03:02 AM
Automatically number a worksheet Jim C. Excel Discussion (Misc queries) 1 September 23rd 05 11:44 PM


All times are GMT +1. The time now is 06:43 PM.

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"