List values in an array?

TheWennerWoman

Active Member
Joined
Aug 1, 2019
Messages
303
Office Version
  1. 365
Platform
  1. Windows
Hello, how do I push the values of this array out to Sheet6 starting at row 1
VBA Code:
 Dim d As Object, r As Range, c, a, i As Long
    Set d = CreateObject("scripting.dictionary")
    For Each r In ws1.Range("B3", ws1.Cells(Rows.Count, "B").End(xlUp))
        For Each c In Split(r, ",")
            d(c) = 1
        Next c
    Next r
    a = Application.Transpose(d.keys)

Thanks in advance.

I tried this but it fell over
VBA Code:
 For iRw = LBound(a) To UBound(a)
      Sheet6.Cells(iRw, 2).Value = a(iRw, 1)
   Next iRw
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
"fell over" is not particularly useful info... ;)

The code is fine so I'd suspect you don't have a sheet in the code workbook with codename sheet6
 
Upvote 1
Solution
Many thanks - you are right, I was getting confused between the way sheets are named in Excel.

In project Explorer I see Sheet1 (data) for example, I can never remember which syntax to use to reference (in this case) Sheet1 or data :)
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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