Concatenated range to array

Philippe.T

Board Regular
Joined
Jan 30, 2012
Messages
94
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello all,

The following allows me to populate an array with values from a range
VBA Code:
Dim ARR1As Range
Set ARR1 = range("D2:D10")

I was wondering if there is a way to concate a range and then populate the array
Not correct but something like
VBA Code:
Dim ARR2As Range
Set ARR2= range("A2:D10")
 

Attachments

  • X.png
    X.png
    23.3 KB · Views: 6

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi
Try this
VBA Code:
Sub test2()
    Dim arr2 As Variant
    ReDim a(1 To 10)
    Dim i
    For i = 2 To 10
        a(i) = Join(Application.Transpose(Application.Transpose(Range("a" & i & ":D" & i))), ",")
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,979
Members
448,934
Latest member
audette89

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