MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Error reloading array using VLOOKUP

Posted by John on October 15, 2000 6:20 AM

I am receiving a "subscript out of range" error in my VBA code when I am trying to upload a fixed array from a worksheet using VLOOKUP. This is part of a model that iterates through changes in a series of input values in a worksheet, uploads the revised values to an array, and then runs calculations within the VBA code on the array. My initial loading of the array works fine, but when I try to reload it I get the subscript error. I've tried changing the size of the static array, and using dynamic arrays, but neither have worked. Any suggestions?

Posted by Ivan Moala on October 15, 2000 7:51 PM

The subscript out of range can be for a number of
1) you have not specified the inner and out range
for the range you are pasting to ??
2) wrong name referenced.

What is the code you are using


Posted by John on October 16, 2000 2:48 PM

Thanks ... but I figured it out. The problem was that I had multiple workbooks open at the time, and used 'ActiveWorkbook' in my lookup string - when I changed it to 'ThisWorkbook' it ran OK.