Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
array question
Want to do something like:
arrayvar = ("alpha","beta","delta") For B = A(1) to A(3) ....... Is this possible? Or do I have to do: arrayvar = ("alpha","beta","delta") For count = 1 to 3 B = A(count) Also, for 3 variables, is this method faster than a if then else procedure? Thank you. Brent |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
array question
What's "A"?
How about: For each thing in array("alpha","beta","delta") 'use "thing" here... Next Bob Umlas Excel MVP "Brent" wrote in message ... Want to do something like: arrayvar = ("alpha","beta","delta") For B = A(1) to A(3) ...... Is this possible? Or do I have to do: arrayvar = ("alpha","beta","delta") For count = 1 to 3 B = A(count) Also, for 3 variables, is this method faster than a if then else procedure? Thank you. Brent |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
array question
sorry meant:
arrayvar = ("alpha","beta","delta") For B = arrayvar(1) to arrayvar(3) would the "for each" be quicker than an "if than else" for three variables? Thank you. Brent "Bob Umlas" wrote: What's "A"? How about: For each thing in array("alpha","beta","delta") 'use "thing" here... Next Bob Umlas Excel MVP "Brent" wrote in message ... Want to do something like: arrayvar = ("alpha","beta","delta") For B = A(1) to A(3) ...... Is this possible? Or do I have to do: arrayvar = ("alpha","beta","delta") For count = 1 to 3 B = A(count) Also, for 3 variables, is this method faster than a if then else procedure? Thank you. Brent |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
array question
Did you mean something like:
dim ArrayVar as variant dim iCtr as long arrayvar = array("alpha","beta","delta") for ictr = lbound(arrayvar) to ubound(arrayvar) msgbox arrayvar(ictr) next ictr Brent wrote: sorry meant: arrayvar = ("alpha","beta","delta") For B = arrayvar(1) to arrayvar(3) would the "for each" be quicker than an "if than else" for three variables? Thank you. Brent "Bob Umlas" wrote: What's "A"? How about: For each thing in array("alpha","beta","delta") 'use "thing" here... Next Bob Umlas Excel MVP "Brent" wrote in message ... Want to do something like: arrayvar = ("alpha","beta","delta") For B = A(1) to A(3) ...... Is this possible? Or do I have to do: arrayvar = ("alpha","beta","delta") For count = 1 to 3 B = A(count) Also, for 3 variables, is this method faster than a if then else procedure? Thank you. Brent -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
array question
Others gave you the proper use of UBound / LBound. Just to add if you wish a simple "1 to 3" as in your example: Sub Demo() Dim V As Variant Dim J As Long ' 0-Based V = Array("Alpha", "Beta", "Delta") ' 1-Based With WorksheetFunction V = .Transpose(.Transpose(V)) End With For J = 1 To 3 MsgBox Format(J, "##: ") & V(J) Next J End Sub -- HTH :) Dana DeLouis Windows XP & Office 2007 "Brent" wrote in message ... sorry meant: arrayvar = ("alpha","beta","delta") For B = arrayvar(1) to arrayvar(3) would the "for each" be quicker than an "if than else" for three variables? Thank you. Brent "Bob Umlas" wrote: What's "A"? How about: For each thing in array("alpha","beta","delta") 'use "thing" here... Next Bob Umlas Excel MVP "Brent" wrote in message ... Want to do something like: arrayvar = ("alpha","beta","delta") For B = A(1) to A(3) ...... Is this possible? Or do I have to do: arrayvar = ("alpha","beta","delta") For count = 1 to 3 B = A(count) Also, for 3 variables, is this method faster than a if then else procedure? Thank you. Brent |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
array question | Excel Discussion (Misc queries) | |||
Array Question | Excel Discussion (Misc queries) | |||
For Each Array Question | Excel Programming | |||
array question | Excel Programming | |||
Array question | Excel Programming |