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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Status
Not open for further replies.

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

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