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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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,215,261
Messages
6,123,942
Members
449,134
Latest member
NickWBA

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