Transposing a Horizontal Letter Sequence into a Vertical Letter Sequence

rwmill9716

Active Member
Joined
May 20, 2006
Messages
493
Office Version
  1. 2013
Platform
  1. Windows
I have converted the words in Column D into a horizontal list of letters (Cols F-N). I need a macro that builds a continuous vertical listing of these letters (Col B). In my Excel sheet there are hundreds of words.



Splitting Words.xlsx
BCDEFGHIJKLMN
19Words123456789
20iinin       
21nthethe      
22tbeginningbeginning
23hgodgod      
24ecreatedcreated  
25bthethe      
26eheavenheaven   
27gandand      
28ithethe      
29nearthearth    
30nandand      
31ithethe      
32nearthearth    
33gwaswas      
Genesis
Cell Formulas
RangeFormula
F20:N33F20=MID($D20,COLUMNS($D$20:D$20),1)
B20B20=MID($D20,COLUMNS($D$20:D$20),1)
B21B21=MID($D20,COLUMNS($D$20:E$20),1)
B22B22=MID($D21,COLUMNS($D$20:D$20),1)
B23B23=MID($D21,COLUMNS($D$20:E$20),1)
B24B24=MID($D21,COLUMNS($D$20:F$20),1)
B25B25=MID($D22,COLUMNS($D$20:D$20),1)
B26B26=MID($D22,COLUMNS($D$20:E$20),1)
B27B27=MID($D22,COLUMNS($D$20:F$20),1)
B28B28=MID($D22,COLUMNS($D$20:G$20),1)
B29B29=MID($D22,COLUMNS($D$20:H$20),1)
B30B30=MID($D22,COLUMNS($D$20:I$20),1)
B31B31=MID($D22,COLUMNS($D$20:J$20),1)
B32B32=MID($D22,COLUMNS($D$20:K$20),1)
B33B33=MID($D22,COLUMNS($D$20:L$20),1)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try this:

VBA Code:
Sub Transposing_Horizontal_Letter()
  Dim c As Range
  Dim i As Long, j As Long
 
  i = 20
  For Each c In Range("D20", Range("D" & Rows.Count).End(3))
    For j = 1 To Len(c.Value)
      Range("A" & i).Value = Mid(c.Value, j, 1)
      i = i + 1
    Next
  Next
End Sub

--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------
 
Upvote 0
Solution
Try this:

VBA Code:
Sub Transposing_Horizontal_Letter()
  Dim c As Range
  Dim i As Long, j As Long
 
  i = 20
  For Each c In Range("D20", Range("D" & Rows.Count).End(3))
    For j = 1 To Len(c.Value)
      Range("A" & i).Value = Mid(c.Value, j, 1)
      i = i + 1
    Next
  Next
End Sub

--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------
Thanks, Dante, that does exactly what I wanted it to
 
Upvote 0
Just noting that the macro to do this can do it without using a loop...
VBA Code:
Sub Transposing_Horizontal_Letter()
  Dim V As Variant
  V = Split(StrConv(Join(Application.Transpose(Range("D20", Cells(Rows.Count, "D").End(xlUp)).Value), ""), vbUnicode), Chr(0))
  Range("A20").Resize(UBound(V)) = Application.Transpose(V)
End Sub
 
Last edited:
Upvote 0
Just noting that the macro to do this can do it without using a loop...
VBA Code:
Sub Transposing_Horizontal_Letter()
  Dim V As Variant
  V = Split(StrConv(Join(Application.Transpose(Range("D20", Cells(Rows.Count, "D").End(xlUp)).Value), ""), vbUnicode), Chr(0))
  Range("A20").Resize(UBound(V)) = Application.Transpose(V)
End Sub
Thanks, Rick, this works well too.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

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