How would I create a macro to sort each row alphabetically?

JonnyEnglish89

New Member
Joined
Jan 29, 2016
Messages
10
A
B
C
D
E
F
1
Kylen
Petrisis
Nexor
Silus the Corrupt
Krellus
Conqueror Krellus
2
Constantine
Barracus
Kylen
Daedalus
Elder Constantine
3
Dracorex
Constantine
Daedalus Enraged
Kylen
Nexor
Typhon Vex

<tbody>
</tbody>

I recorded a macro whilst using the custom sort feature in excel but I couldn’t figure out how to modify the recording to iterate though the rows
Any help would be appreciated
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hello JonnyEnglish,

Do you want to sort a single column of your choice or all columns at once?
 
Upvote 0
This code sorts EACH ROW:-

Code:
[COLOR="Navy"]Sub[/COLOR] MG24Nov42
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, RngAc [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range("A2", Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]Set[/COLOR] RngAc = Range(Cells(Dn.Row, 1), Cells(Dn.Row, Columns.Count).End(xlToLeft))
    RngAc.Sort RngAc(1), xlAscending, Orientation:=xlLeftToRight
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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