Assigning range to array not working

M

Marston

Can someone explain why this isn't working?

Sub Test()
Dim aArray as Variant

Set rng = Range("A1").CurrentRegion.Select
aArray = rng.Value

End Sub

When I break the code I see the following when I highlight
aArray

(on the Set rng, I put arrow of rng and I see: rng = nothing)
(on the rng.Value, I see <Object variable or With block variable not set>

I have values in a 51000 x 10 range beginning at "A1"
 
A

Alan Beban

Marston said:
Can someone explain why this isn't working?

Sub Test()
Dim aArray as Variant

Set rng = Range("A1").CurrentRegion.Select
aArray = rng.Value

End Sub

When I break the code I see the following when I highlight
aArray

(on the Set rng, I put arrow of rng and I see: rng = nothing)
(on the rng.Value, I see <Object variable or With block variable not set>

I have values in a 51000 x 10 range beginning at "A1"

Drop the .Select

Alan Beban
 
M

Marston

Thanks Alan -

and please disregard the next message too.....I think I'm back to where I was
yesterday - at least I'm able to write out my arrays now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top