![]() |
Extracting nth element of X dimension
I have a 5D array. I have counters which I use for the first, third,
fourth, and fifth dimensions when I want to pass values into the array. However, the length of the second dimension is changing constantly as I build my routine and I have hard coded a number 9 in it currently. I need to reference this 9 elsewhere. So as I decide to expand the 2nd dimension to say 10, I will have to make sure that I change all the other 9s to 10. Is there a way extract the value that is currently in the second dimension (i.e. the 9) and pass it to a variable that I can use elsewhere? Array1(Counter1, 9, Counter2, Counter3, Counter4) = 250 SecondDimensionVariable = UBound(UnitOfferArray, 2) will only tell me what I set the max to. I want to know what it currently is? --- Message posted from http://www.ExcelForum.com/ |
Extracting nth element of X dimension
there is no concept of currently is associated with an array.
Define a constant and use that as the value for the second dimension. Then you can query the value of the constant Public Const Myval As Long = 9 Sub ShowConst() MsgBox Myval Array1(Counter1, Myval, Counter2, Counter3, Counter4) = 250 End Sub -- Regards, Tom Ogilvy ExcelMonkey wrote in message ... I have a 5D array. I have counters which I use for the first, third, fourth, and fifth dimensions when I want to pass values into the array. However, the length of the second dimension is changing constantly as I build my routine and I have hard coded a number 9 in it currently. I need to reference this 9 elsewhere. So as I decide to expand the 2nd dimension to say 10, I will have to make sure that I change all the other 9s to 10. Is there a way extract the value that is currently in the second dimension (i.e. the 9) and pass it to a variable that I can use elsewhere? Array1(Counter1, 9, Counter2, Counter3, Counter4) = 250 SecondDimensionVariable = UBound(UnitOfferArray, 2) will only tell me what I set the max to. I want to know what it currently is? --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 02:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com