Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
QB QB is offline
external usenet poster
 
Posts: 57
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable variables and sub routines Also Excel Programming 5 February 5th 08 05:34 PM
Passing Variable length Space Characters to Variables ExcelMonkey Excel Programming 5 February 7th 06 11:34 PM
Select one variable from a list of variables by clicking one cell Curt Excel Discussion (Misc queries) 2 July 21st 05 01:44 AM
Newbie Macro Query - Clearing Variables and Assigning a Variable Mcneilius[_5_] Excel Programming 3 September 5th 04 11:10 AM


All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"