VBA: how to refer to an element in a named range (array/matrix)

Status
Not open for further replies.

Pascalvrolijk

Board Regular
Joined
May 28, 2004
Messages
68
Hi all, i would like to ask your help on this. Been trying, been googling but didnt get it yet..

In Excel I named cell A1 as: selected_fund and I named cells A5:A10 as fundnames.

So in VBA I want to do a for loop as follows:
for i=1 to 6
[selected_fund].value=[fundnames](i).value
...
next i

This should result in A1=A5.value, then A1=A6.value, ..., then A1=A10.value.
If I replace [fundnames](i).value by [A5], [A6], ..., [A10] it works fine of course, but i want to use reference to an element in an array/matrix.

however i get an error on [fundnames](i).value: "incorrect number of arguments or incorrect property assignment"

Who can help me out to make the reference to an element in [fundnames]?

Thanks in advance,
Kind regards,
Pascal.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Status
Not open for further replies.

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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