CJ_22
New Member
- Joined
- Mar 22, 2016
- Messages
- 19
I am converting a column that has cells which contain comma separated values.
I want to take these cells and create another column that has each of these comma separated values in their own row.
I have found a script that works but I am also trying to deconstruct for learning purposes.
The one line I am getting hung up on is:
I get what "Split" and "Join" do but I do not understand what Application.transpose(Rg.Value) is doing specifically. If anyone can help explain to me exactly what is doing I would be very grateful.
Thank you,
Chris
I want to take these cells and create another column that has each of these comma separated values in their own row.
I have found a script that works but I am also trying to deconstruct for learning purposes.
VBA Code:
Public Sub transpose_multiple()
Dim xArr() As String
Dim xAddress As String
Dim Rg As Range
Dim Rg1 As Range
On Error Resume Next
xAddress = Application.ActiveWindow.RangeSelection.Address
Set Rg = Application.InputBox("please select the data range:", "Transpose Tool", xAddress, Type:=8)
If Rg Is Nothing Then Exit Sub
Set Rg = Application.Intersect(Rg, Rg.Parent.UsedRange)
If Rg Is Nothing Then Exit Sub
Set Rg1 = Application.InputBox("please select output cell:", "Transpose Tool", Type:=8)
If Rg1 Is Nothing Then Exit Sub
xArr = Split(Join(Application.transpose(Rg.Value), ","), ",")
Rg1.Resize(UBound(xArr) + 1) = Application.transpose(xArr)
Rg1.Parent.Activate
Rg1.Resize(UBound(xArr) + 1).Select
End Sub
The one line I am getting hung up on is:
VBA Code:
xArr = Split(Join(Application.transpose(Rg.Value), ","), ",")
I get what "Split" and "Join" do but I do not understand what Application.transpose(Rg.Value) is doing specifically. If anyone can help explain to me exactly what is doing I would be very grateful.
Thank you,
Chris