0

I'm looking for a way to create an array from a variable range in VBA. I've seen a similar posting but I can not find the way to adjust it to a variable range.

What I have is a Sheet with variable columns and I want store these into an array. So far I have the following code, but it is giving an error when trying to assign the dynamic range (HCRng)

Sub TestColumnNames()
Dim ArrayColumns As Variant
Dim HCRng As Range
HCRng = Sheets("HC").Range("A1", Selection.End(xlToRight))
ArrayColumns = HCRng.Value
End Sub

Any ideas?

Community
  • 1
  • 1
Selrac
  • 2,203
  • 9
  • 41
  • 84

0 Answers0