Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Subscript out of range error

Hi

I am trying to open a file and do some operation on it.

I am using the following statement in my code -

strMetricsFile = ActiveWorkbook.FullName
While Trim(Workbooks(strMetricsFile).ActiveSheet.Range(" A" &
intCurrentRowMetrics).Value) < ""

I am getting an error message - Subscript out of range

If I use the File name directly in the above statement instead of
strMetricsFile, the code runs fine. But if I use the variable instead
of the file name, it gives me the error.

Can anyone please help !

Thanks
Vishal

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Subscript out of range error

I would guess it should be

strMetricsFile = ActiveWorkbook.Name
While Trim(Workbooks(strMetricsFile).ActiveSheet.Range(" A" &
intCurrentRowMetrics).Value) < ""


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Vishal" wrote in message
oups.com...
Hi

I am trying to open a file and do some operation on it.

I am using the following statement in my code -

strMetricsFile = ActiveWorkbook.FullName
While Trim(Workbooks(strMetricsFile).ActiveSheet.Range(" A" &
intCurrentRowMetrics).Value) < ""

I am getting an error message - Subscript out of range

If I use the File name directly in the above statement instead of
strMetricsFile, the code runs fine. But if I use the variable instead
of the file name, it gives me the error.

Can anyone please help !

Thanks
Vishal



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Subscript out of range error

thanks !
it worked.

Now I am facing a different problem. The macro runs fine on my
machine. But when I execute it on some other machine, I get an error
message- "Can't fine project or library" ! Any suggestions ?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Subscript out of range error

Sounds like you have a referenced library that is not on that machine. Go to
ToolsReferences in the VBIDE and see what is missing.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Vishal" wrote in message
oups.com...
thanks !
it worked.

Now I am facing a different problem. The macro runs fine on my
machine. But when I execute it on some other machine, I get an error
message- "Can't fine project or library" ! Any suggestions ?



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 error moglione1 Excel Discussion (Misc queries) 2 August 30th 05 01:21 PM
Type Mismatch error & subscript out of range error Jeff Wright[_2_] Excel Programming 3 May 14th 05 07:14 PM
subscript out of range error Darren Excel Programming 3 November 24th 04 03:38 PM
Subscript Out Of Range Error? Michael Vaughan Excel Programming 3 November 9th 04 11:35 AM
Subscript out of range error Tom Ogilvy Excel Programming 0 December 10th 03 12:48 AM


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