Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 11
Default SubScript Out Of Range.

Last week some nice folks here gave me a few tips, and I was able to get
the macro I had been working on to run properly. Thanks!

But today, I ran the same macro on a worksheet that was laid out exactly
like the earlier one, and I got `Subscript Out Of Range.' error. I made no
chages to the code.

Here is the line that program stopped at:

FullName = Worksheets("Sheet1").Cells(I, 4).Value

I thought maybe the error was caused because the macro was not actually
in the workbook I was using. I copied it to that workbook, but same thing
happened.

Anybody have any idea??

Sam

A man who had lately declared
That property ought to be shared,
Thought it going too far
When they called for his car,
And a list of exceptions prepared.

Thomas Thorneley,
From The Penguin
Book Of Limericks


  #2   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 11
Default I ThinK I Figured It Out.

"Sam" wrote in message
link.net...
Last week some nice folks here gave me a few tips, and I was able to

get
the macro I had been working on to run properly. Thanks!

But today, I ran the same macro on a worksheet that was laid out

exactly
like the earlier one, and I got `Subscript Out Of Range.' error. I made no
chages to the code.

Here is the line the program stopped at:

FullName = Worksheets("Sheet1").Cells(I, 4).Value

Apparently the syntax has to be:

FullName = Worksheets(1).Cells(I, 4).Value

I have no clue why, but my program runs after I made that change.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default I ThinK I Figured It Out.

Maybe you sheet name have a space before it like
" Sheet1"

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam" wrote in message link.net...
"Sam" wrote in message
link.net...
Last week some nice folks here gave me a few tips, and I was able to

get
the macro I had been working on to run properly. Thanks!

But today, I ran the same macro on a worksheet that was laid out

exactly
like the earlier one, and I got `Subscript Out Of Range.' error. I made no
chages to the code.

Here is the line the program stopped at:

FullName = Worksheets("Sheet1").Cells(I, 4).Value

Apparently the syntax has to be:

FullName = Worksheets(1).Cells(I, 4).Value

I have no clue why, but my program runs after I made that change.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default I ThinK I Figured It Out.

msgbox "==" & Worksheets(1).name & "<==="

would let you know what the actual name is. You might have a space or two
on one end or the other.

--
Regards,
Tom Ogilvy

Sam wrote in message
link.net...
"Sam" wrote in message
link.net...
Last week some nice folks here gave me a few tips, and I was able to

get
the macro I had been working on to run properly. Thanks!

But today, I ran the same macro on a worksheet that was laid out

exactly
like the earlier one, and I got `Subscript Out Of Range.' error. I made

no
chages to the code.

Here is the line the program stopped at:

FullName = Worksheets("Sheet1").Cells(I, 4).Value

Apparently the syntax has to be:

FullName = Worksheets(1).Cells(I, 4).Value

I have no clue why, but my program runs after I made that change.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SubScript Out Of Range.

The line of code you included your coordinates are wrong. You listed i
as (I, 4). Now if you want cell "I4" as it is in Excel, you need t
change what you have to (4, 8). This is because VBA uses X
coordinates. The first number corresponds to the rows in Excel and th
second to the columns. Assuming I guessed correctly, you want th
fourth cell down in the eight column. Anyway, VBA also lets you us
the format ("I4") in some cases, though not always, so I find it easie
to only use the one way that always works all the time. It cuts dow
on the confusion. - Pikus:

--
Message posted from http://www.ExcelForum.com



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
Subscript out of range OKHM Excel Discussion (Misc queries) 0 August 6th 09 05:18 PM
Subscript out of Range Steve Excel Discussion (Misc queries) 3 April 15th 09 04:01 PM
what does 'Subscript Out of range' mean?? Gary Excel Worksheet Functions 2 March 22nd 07 01:33 AM
9: Subscript out of range jenz21985 Excel Discussion (Misc queries) 6 May 5th 06 03:36 PM
Subscript Out of Range John Wilson Excel Programming 2 September 7th 03 04:07 AM


All times are GMT +1. The time now is 10:14 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"