Anclar el rango a ordenar con macro

Hola expertos! Tengo el siguiente código:

Private Sub ORAZ()
Sheets("Hoja 1").Select

A = InputBox("INGRESA LA LETRA DE LA COLUMNA QUE QUIERES ORDENAR", "ORDENAR A/Z", , 500, 500)
ActiveSheet.Unprotect "ábrete"
ActiveWorkbook.Worksheets("Hoja 1").AutoFilter.Sort.SortFields.Clear ActiveWorkbook.Worksheets("Hoja 1").AutoFilter.Sort.SortFields.Add Key:= _ Range("" & A & "9:" & A & "1009"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _ :=xlSortNormal With ActiveWorkbook.Worksheets("Hoja 1").AutoFilter.Sort .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With

ActiveSheet.Protect Password:="ábrete", DrawingObjects:=False, Contents:=True, Scenarios:= _ False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True, AllowInsertingRows:=True, _ AllowInsertingHyperlinks:=True, AllowDeletingRows:=True, AllowSorting:= _ True, AllowFiltering:=True, AllowUsingPivotTables:=True ActiveSheet.EnableSelection = xlNoRestrictions

End Sub

lo que hace es ordenar en orden ascend

Añade tu respuesta

Haz clic para o