Array Error

AnilPullagura

Board Regular
Joined
Nov 19, 2010
Messages
98
Pros,

I am trying to assign an array to a Range of cells using End(xlToRight) property. I am still learning Arrays and would need help on the below code.

Code:
ColHeads = Array(Worksheets(wkshtnames(m)).Range("A1" & Range("A1").End(xlToRight).Address))

Macro is throwing an Error on this Line: Application-Defined or Object-Defined Error

Help Required.

Thanks,
Anil
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try:

Code:
ColHeads = Array(Worksheets(wkshtnames(m)).Range(Range("A1"),Range("A1").End(xlToRight)))

Denis
 
Upvote 0
How about:
Code:
With Worksheets(wkshtnames(m))
ColHeads = .Range(.Range("A1"),.Range("A1").End(xlToRight)).Value
End With
?

It gives a 2 dimensional array, ColHeads(1,n), where n is number of columns.
 
Upvote 0
...
However, Both did not work
...

In what way did it not work? It is that you got an error message? Or what? You must give a reasonable amount of information, or else, how are people supposed to help!
 
Upvote 0
Could you give some more detail on what you want? And, as Glenn said, which bit 'didn't work'?

We can only help if we know what is needed, or else we are flying blind.

Denis
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

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