Macro para ordenar alfabéticamente por fila y después por columna

Dante001

New Member
Joined
May 25, 2014
Messages
1
Buen día, he estado revisando en el foro en busca de un cierto macro pero no encuentro uno que haga lo que necesito.
Quisiera saber si es posible un macro que tome por ejemplo estos datos

[TABLE="width: 320"]
<tbody>[TR]
[TD][TABLE="width: 320"]
<tbody>[TR]
[TD]4[/TD]
[TD]B4[/TD]
[TD]A3[/TD]
[TD]B2[/TD]
[TD]D3[/TD]
[/TR]
[TR]
[TD]D1[/TD]
[TD]A2[/TD]
[TD]C4[/TD]
[TD]2[/TD]
[TD]C3[/TD]
[/TR]
[TR]
[TD]B1[/TD]
[TD]D2[/TD]
[TD]3[/TD]
[TD]C1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]B3[/TD]
[TD]D4[/TD]
[TD]A4[/TD]
[TD]A1[/TD]
[TD]C2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

y los acomode alfabéticamente de esta forma

[TABLE="width: 256"]
<tbody>[TR]
[TD][TABLE="width: 320"]
<tbody>[TR]
[TD]A1[/TD]
[TD]B1[/TD]
[TD]C1[/TD]
[TD]D1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]C2[/TD]
[TD]D2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]C3[/TD]
[TD]D3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD]B4[/TD]
[TD]C4[/TD]
[TD]D4[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

el rango máximo de datos seria desde la columna A hasta AA (A:AA) considerando que tuviera datos desde a hasta z, más los números. Primero consideré un macro como este para las 27 columnas, solo modificando el rango

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
With Range("A:A")
.Sort Key1:=.Cells(1, 1)
.Orientation = xlTopToBottom
End With
End If
If Target.Column = 2 Then
With Range("B:B")
.Sort Key1:=.Cells(1, 1)
.Orientation = xlTopToBottom
End With
End If
End Sub

¿Pero es posible que al ingresar el dato en cualquier parte de la hoja lo acomode alfabéticamente primero considerando el orden de las filas y luego el de las columnas?

Gracias.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,223,933
Messages
6,175,475
Members
452,646
Latest member
tudou

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