Ordenar datos con una macro en xls
Hola estoy necesitando resolver un tema para poder ordenar datos que ingreso mediante UserForm a una planilla de xls, y no me esta funcionando correctamente ya que cuando ingreso los datos en un rango de celdas determinados, quiero que seleccione el rango con datos para ordenarlos y no lo hace correctamente, ya que una vez que los ordena como ultimo dato me ingresa la dirección de la celda activa final y no el dato que ingrese.
Por otra parte si uso este código para ordenar datos fijos lo hace correctamente.
Les paso el código :
Range("an3").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-1, 0).Select
Do While ActiveCell <> Empty
ActiveCell.Offset(0, 1).Select
Loop
ActiveCell.Offset(0, -1).Select
ActiveCell = ActiveCell.Address
Range("An3:" + ActiveCell).Select
Selection.Sort Key1:=Range("An3"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Gracias
Por otra parte si uso este código para ordenar datos fijos lo hace correctamente.
Les paso el código :
Range("an3").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-1, 0).Select
Do While ActiveCell <> Empty
ActiveCell.Offset(0, 1).Select
Loop
ActiveCell.Offset(0, -1).Select
ActiveCell = ActiveCell.Address
Range("An3:" + ActiveCell).Select
Selection.Sort Key1:=Range("An3"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Gracias
{"lat":-37.7185903255881,"lng":-59.765625}
1 respuesta
Respuesta de Cadipas spain
1