View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
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