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 Subscript out of range

I have:

Dim SrcNm1 As String
Dim SrcNm2 As String
Dim WS1 As Worksheet, WS2 As Worksheet
SrcNm1 = "Sheet2"
SrcNm2 = "ClientLedgerOct31"

Set WS1 = ThisWorkbook.Worksheets(SrcNm1)
' WS1 is now successfully set as Worksheet/Sheet2
Set WS2 = ThisWorkbook.Worksheets(SrcNm2)
' This line throws up a Runtime error '9' - "Subscript out of range"
error

Why do I get the error when setting WS2 but not WS1? Is it because
there are too many letters in the sheet name?
The sheet with that name definitely exists, and the spelling is
correct etc.

Thanks
 
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
subscript out of range (help) edluver Excel Programming 2 October 31st 07 04:55 PM
Subscript out of range? Dave Birley Excel Programming 5 May 31st 07 03:14 PM
subscript out of range [email protected] Excel Programming 5 February 19th 07 08:28 PM
Subscript out of range teresa Excel Programming 1 December 14th 04 09:56 PM
Subscript out of Range Q John Excel Programming 5 December 14th 04 07:54 AM


All times are GMT +1. The time now is 11:32 PM.

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"