Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run-time error 9 - Subscript out of range (again)

I have searched far and wide and found several questions on subscript
out of range issue, but none of these questions seem to be similar to
mine. I am very new to VBA, so my vocabulary may not be standard...

I received an old spreadsheet application from a co-worker. When I
ran the macro that activate a VBA code, it ran fine and produce
correct results.


The problem occurs when I made changes to some of the data entries
(all floats) to tweak the model, I got the run-time error 9. The
changes are within the original range and of the same data type.
Since nothing else were changed (e.g. tab name, etc) so I assumed the
problem was not caused by typo as it seems to be the common source of
this error.


When I debug the code, I found

- The error occurred at line
Set w1 = ActiveWorkbook.Worksheets(Trim$
(run_.terminal_model_name))
where run_ is an object defined early on in the code.

- The value of "run_.terminal_model_name" was different from the
correct value when the model ran successfully. This suggests VBA was
confused and get the worksheet all mixed up.

Also, even when I undo the changes back to original, the code still
produce the same error.
I am refraining from posting he entire code since it is a bit large
and hard to read. Besides, I might have to discuss posting the code
to public forum with my co-worker who crated this code.

I am really stumped and would very much appreciate any idea of what
causes this problem and how to solve it.

pax
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Run-time error 9 - Subscript out of range (again)

the dollar sign and under_score may indicate that this code was meant to be
used with some assembly language code that isn't expecting the change to a
float variable. You may be cuasing a problem with passing the variable in
the stack to the assembly language routine (or possibly another language
like C language).

I would need to see more of the code, but I suspect the "RUN Structure TYPE"
is being used to pass the data to another program that isn't expecting the
Float type variable. the number of memory locations for a floating point
variable is different from a single or double type varaiable.

"packat" wrote:

I have searched far and wide and found several questions on subscript
out of range issue, but none of these questions seem to be similar to
mine. I am very new to VBA, so my vocabulary may not be standard...

I received an old spreadsheet application from a co-worker. When I
ran the macro that activate a VBA code, it ran fine and produce
correct results.


The problem occurs when I made changes to some of the data entries
(all floats) to tweak the model, I got the run-time error 9. The
changes are within the original range and of the same data type.
Since nothing else were changed (e.g. tab name, etc) so I assumed the
problem was not caused by typo as it seems to be the common source of
this error.


When I debug the code, I found

- The error occurred at line
Set w1 = ActiveWorkbook.Worksheets(Trim$
(run_.terminal_model_name))
where run_ is an object defined early on in the code.

- The value of "run_.terminal_model_name" was different from the
correct value when the model ran successfully. This suggests VBA was
confused and get the worksheet all mixed up.

Also, even when I undo the changes back to original, the code still
produce the same error.
I am refraining from posting he entire code since it is a bit large
and hard to read. Besides, I might have to discuss posting the code
to public forum with my co-worker who crated this code.

I am really stumped and would very much appreciate any idea of what
causes this problem and how to solve it.

pax
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run-time error 9 - Subscript out of range (again)

On Oct 20, 4:37*am, Joel wrote:
the dollar sign and under_score may indicate that this code was meant to be
used with some assembly language code that isn't expecting the change to a
float variable. *You may be cuasing a problem with passing the variable in
the stack to the assembly language routine *(or possibly another language
like C language).

I would need to see more of the code, but I suspect the "RUN Structure TYPE"
is being used to pass the data to another program that isn't expecting the
Float type variable. *the number of memory locations for a floating point
variable is different from a single or double type varaiable.

"packat" wrote:
I have searched far and wide and found several questions on subscript
out of range issue, but none of these questions seem to be similar to
mine. *I am very new to VBA, so my vocabulary may not be standard...


I received an old spreadsheet application from a co-worker. *When I
ran the macro that activate a VBA code, it ran fine and produce
correct results.


The problem occurs when I made changes to some of the data entries
(all floats) to tweak the model, I got the run-time error 9. *The
changes are within the original range and of the same data type.
Since nothing else were changed (e.g. tab name, etc) so I assumed the
problem was not caused by typo as it seems to be the common source of
this error.


When I debug the code, I found


- *The error occurred at line
* * * * *Set w1 = ActiveWorkbook.Worksheets(Trim$
(run_.terminal_model_name))
* *where run_ is an object defined early on in the code.


- *The value of "run_.terminal_model_name" was different from the
correct value when the model ran successfully. *This suggests VBA was
confused and get the worksheet all mixed up.


Also, even when I undo the changes back to original, the code still
produce the same error.
I am refraining from posting he entire code since it is a bit large
and hard to read. *Besides, I might have to discuss posting the code
to public forum with my co-worker who crated this code.


I am really stumped and would very much appreciate any idea of what
causes this problem and how to solve it.


pax
.


Thanks Joel. Your response makes the most sense since I have been
asking this question around in various user group and help board! I
will look further into this.

pax
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
Run-Time 9 Subscript ouf of Range Error Excel Monkey[_2_] Excel Programming 4 April 23rd 09 10:55 PM
Run time error 9 (Subscript Out Of Range) Heera Excel Programming 2 May 14th 08 04:42 PM
Run-time error '9': Subscript out of range Little Penny Excel Programming 6 September 11th 07 12:54 PM
run time error 9, subscript out of range [email protected] Excel Programming 6 July 7th 06 02:35 AM
Run time error 9 (subscript out of range) Nathaniel Tigere Excel Programming 2 August 5th 03 11:12 AM


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