![]() |
variable variables
Hi am trying to write some vba code that will adapt with my very variable
data. As such, I am using arrays, etc. The basics work, but I have now hit a little bump in the road that I hope someoe can show me how to get around. Basically, for each item in the array, I need to store certain value into variable. I was trying to build these variable using the array item number, but don't seem to be able to get the code right. For instance, For i = LBound(Array1) to UBound(Array1) 'I perform a filter on my data here (Removed to simplify my code) "Sub" & Array1(i) = Range("SubTotal").Value Next i Basically I want to create a series of sequential variable holding the values: Sub1 = Sub2 = Sub3 = How can this be done? QB |
variable variables
Sub test() Dim Mytotals() As Variant ReDim Mytotals(LBound(Array1) To UBound(Array1)) For i = LBound(Array1) To UBound(Array1) Mytotals(i) = Range("SubTotal").Value Next i End Sub -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=157526 Microsoft Office Help |
All times are GMT +1. The time now is 09:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com