Array

nada

Board Regular
Joined
Jul 4, 2006
Messages
193
Hi! I am trying to create an array that looks like this:
vtFields = Array(Range("B4").Value, Range("R4").Value)
This works fine but I want the array to contain Range("b4").value to eg Range("CC109").value and then it takes ALOT of time to write the array manually. is there any way of doing this without writing every element in the array? Thanks for any help!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
thanx but i have tried that and it does not work. let me specify what im mean. I have a long list, lets say in column A. I then want to create an array that contains the values of the list in column A. Thus the array needs to have the same dimension as the length of the list. When I try your example the array has 0 dimension and I cannot get anything out of it. thanks for your help but I need some other solution. any help appreciated!
 
Upvote 0
Hi

Make sure you have the variable dimensioned as a variant:

Code:
Dim vArray as Variant
vArray = Range("A1:A100") 'assigns all the values in A1:A1000 to a 2 dimensional array with Ubound(vArray,1) of 1000 and Ubound(vArray,2) of 1

Richard
 
Upvote 0

Forum statistics

Threads
1,221,522
Messages
6,160,308
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top