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: 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
 
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 08:38 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"