Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Array handling error
Hi
It's not easy to make good suggestions when you can't see your full code, but have you ReDimensioned the YearD() dynamic array prior to attempting to place values in it? Best regards Richard PALysiak wrote: I am trying to extract all of the column 9 data in the GoodArray(), earlier in the program it is filled with data (I checked the locals window, it is dimensioned properly and filled with what I want). When I go to take the data from cell or column 9 from a 2 dimensional array and do a "Left" operation on the data string in the cell and put it in a 1 dimensional array, I get an "Out of Range" error. I added the "Dummy" variable to see if the Left function worked and it does. It just refuses to take the column in a two dimensional array and put it into a one dimensional array. What am I doing wrong? Dim YearD() as variant Dim A As String Dim Dummy as String Dummy = GoodArray(9, i) A = Left(Dummy, 2) YearD(i) = Left(Dummy, 2) 'Extract the year YearD(i) = Right(YearD(i), 1) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Array handling error
Because you dimmed it as a dymanic array, but didn't assign any dimensions.
Now you use redim to assign the dimensions. -- Regards, Tom Ogilvy "PALysiak" wrote in message ... Yes, I believe that works. If I had just Dim the variable a few lines before, why would I redim then? Thanks very much for your quick response. "RichardSchollar" wrote: Hi It's not easy to make good suggestions when you can't see your full code, but have you ReDimensioned the YearD() dynamic array prior to attempting to place values in it? Best regards Richard PALysiak wrote: I am trying to extract all of the column 9 data in the GoodArray(), earlier in the program it is filled with data (I checked the locals window, it is dimensioned properly and filled with what I want). When I go to take the data from cell or column 9 from a 2 dimensional array and do a "Left" operation on the data string in the cell and put it in a 1 dimensional array, I get an "Out of Range" error. I added the "Dummy" variable to see if the Left function worked and it does. It just refuses to take the column in a two dimensional array and put it into a one dimensional array. What am I doing wrong? Dim YearD() as variant Dim A As String Dim Dummy as String Dummy = GoodArray(9, i) A = Left(Dummy, 2) YearD(i) = Left(Dummy, 2) 'Extract the year YearD(i) = Right(YearD(i), 1) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Array handling error
Obviously I am a rookie to this stuff.
When I dimmed it with () or empty array I thought I was assigning the variable a dynamic array. Redimming does work. Again thanks for your help, this was driving me nuts. "Tom Ogilvy" wrote: Because you dimmed it as a dymanic array, but didn't assign any dimensions. Now you use redim to assign the dimensions. -- Regards, Tom Ogilvy "PALysiak" wrote in message ... Yes, I believe that works. If I had just Dim the variable a few lines before, why would I redim then? Thanks very much for your quick response. "RichardSchollar" wrote: Hi It's not easy to make good suggestions when you can't see your full code, but have you ReDimensioned the YearD() dynamic array prior to attempting to place values in it? Best regards Richard PALysiak wrote: I am trying to extract all of the column 9 data in the GoodArray(), earlier in the program it is filled with data (I checked the locals window, it is dimensioned properly and filled with what I want). When I go to take the data from cell or column 9 from a 2 dimensional array and do a "Left" operation on the data string in the cell and put it in a 1 dimensional array, I get an "Out of Range" error. I added the "Dummy" variable to see if the Left function worked and it does. It just refuses to take the column in a two dimensional array and put it into a one dimensional array. What am I doing wrong? Dim YearD() as variant Dim A As String Dim Dummy as String Dummy = GoodArray(9, i) A = Left(Dummy, 2) YearD(i) = Left(Dummy, 2) 'Extract the year YearD(i) = Right(YearD(i), 1) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error Handling - On Error GoTo doesn't trap error successfully | Excel Programming | |||
Error handling with a handling routine | Excel Programming | |||
Handling ubound on an uninitialised array | Excel Programming | |||
error handling off?? | Excel Programming | |||
Error handling | Excel Programming |