SET RANGE with array

Roncondor

Board Regular
Joined
Jun 3, 2011
Messages
83
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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,224,749
Messages
6,180,727
Members
452,995
Latest member
isldboy

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