Dear Forum,
I have this really weird thing happening in my VBA that I've never run across, and I'm wondering if anyone else has? I am populating a variant array with Long values, and then modifying the array by using a WorksheetFunction.Sort to it. Upon doing so, the array gets pre-pended with a null value, as shown below. Has anyone ever heard of this? Here's my code, and the results from the Immediate window.
The code errors-out later at this line, when I try to get the first value from the sorted array. The array is not read or modified between the Sort and the 'EHLegacyIDs(0)' portion of code.Please Login or Register to view this content.
The error I get is a 'Subscript out of Range' error.Please Login or Register to view this content.
Here's the proof that the null value is getting pre-pended, from the Immediate window. These Immediate statements were run when the code was stopped at the error location.
Also, if I send aPlease Login or Register to view this content.
command to the Immediate window at this point, I get the 'Subscript out of Range' error.Please Login or Register to view this content.
Has anyone heard of this happening? I'm using Office 365 on a Windows 10 machine.
Brian
Bookmarks