Code to split word into diagonal cells

dee101

Active Member
Joined
Aug 21, 2004
Messages
282
The code below will spilt a word and put each letter in separate cells, putting the letters to the right of the cell that has the word, how would you split a word out like this but put the letters in diagonal cells, so if I had the word TEST in cell A10 it would put T in B9, E in C8, S in D7 and T in E6?
Thanks

Code:
Sub SplitCells()
Dim c As Range
Dim i As Long
Application.ScreenUpdating = False
    For Each c In Selection
        For i = 1 To Len(c)
        c.Offset(0, i).Value = "" & Mid(c, i, 1) & ""
        Next i
    Next c
Application.ScreenUpdating = True
End Sub
 

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)
Maybe
Code:
c.Offset(-i, i).Value = Mid(c, i, 1)
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,749
Members
452,940
Latest member
rootytrip

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