SET RANGE with array

Roncondor

Board Regular
Joined
Jun 3, 2011
Messages
79
I want to dynamically copy an unknown number of multiple ranges from one spreadsheet to another.

The list of ranges is stored in a table in the "to" spreadsheet with the
- ranges from in a list called "list_from" and the
- ranges to in a list called "list_to"

I want the variable The_Range_from to be able to store multiple ranges so I can access them later when I am in the "From Spreadsheet".

The bolded line always blows up with "run time error 438; Object does not support this property"

Is this possible to do?

Thanks
RK

------------------------------------------------------


Dim FieldList_from() As String
Dim FieldList_toto() As String
Dim The_Range_from() As Range

For X = 1 To Range("List_from").Rows.Count
FieldList_from(X) = Range("List_from").Cells(X).Value
FieldList_toto(X) = Range("List_toto").Cells(X).Value
Set The_Range_from(X) = Range(FieldList_toto(X))
Next X
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try using a collection or dictionary instead. You have created the dynamic array The_Range_from() but didn’t redim it.

redim array(1 to the count you had ) and then run the loop would work too
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,089
Members
448,548
Latest member
harryls

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