Untranspose...

spacely

Board Regular
Joined
Oct 26, 2007
Messages
248
Umm, I forgot why this snippet works...it finds unique values within a selection. I paste only the portion here to make a point. It transposes data in cell Cells(j, 122), Cells(j, 122)

Dim V As Variant, Data As Variant
Data = Selection
With CreateObject("Scripting.Dictionary")
For Each V In Data
If Len(V) Then .Item(V) = 1
Next
Range(Cells(j, 122), Cells(j, 122)).Resize(.Count) = Application.Transpose(.Keys)
End With

...but I don't want it transposed. it's coming vertically, I want it coming horizontally. Maybe I need only change it a bit?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Umm, I forgot why this snippet works...it finds unique values within a selection. I paste only the portion here to make a point. It transposes data in cell Cells(j, 122), Cells(j, 122)

Dim V As Variant, Data As Variant
Data = Selection
With CreateObject("Scripting.Dictionary")
For Each V In Data
If Len(V) Then .Item(V) = 1
Next
Range(Cells(j, 122), Cells(j, 122)).Resize(.Count) = Application.Transpose(.Keys)
End With

...but I don't want it transposed. it's coming vertically, I want it coming horizontally. Maybe I need only change it a bit?
The dictionary keys are already in a horizontal array. Try:

Cells(j, 122).Resize(1,.Count) = .Keys
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,031
Members
448,940
Latest member
mdusw

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