share an example sheet for better idea...
atleast 5 instances
+
*I did not do this for you. God is here working through me for you.*
On Tue, Dec 2, 2014 at 4:41 PM, Mahesh Patil wrote:
> Hi Paul,
> Thans for reply.
> I am looking to create variable at runtime.
>
> Ex:
> Sub test()
> Dim X
” - John Wesley
-
>
> From: Mahesh Patil
>To: excel-macros@googlegroups.com
>Sent: Tuesday, December 2, 2014 6:11 AM
>Subject: Re: $$Excel-Macros$$ VBA : How to create array dynamically
>
>
>
>Hi Paul,
>Thans for reply.
>I am looking to create variable a
Hi Paul,
Thans for reply.
I am looking to create variable at runtime.
Ex:
Sub test()
Dim X as range
X =Activeworkbook.worksheet("sheet1").range("A1:A100")
For each i in X
Dim i as integer
Next i
End sub
'This code wont work
' I need to create 100 variables 'having name mentioned in each 'cell
First of all, it LOOKS like you're wanting to create a two dimensional array.
This is "normally" handled by something like:
dim arname(3,50)
Then, you'd use:
arname(0,0) = "country"
arname(1, 0) = "state"
arname(2, 0) = "city"
if you want to change an array size, you use:
Redim narray(3,50)