Hola a todos.
Jimy Flechas. Con tu código y quitando lo de
seleccionar rangos, me tarda 40 segundos (no es mejora significativa de tiempo, pero...):
Sub EliminaFilasVacias()
Dim filaDesde#, NumFil#, NumCol#
Dim HojaRango As Range
Dim tProceso As Double
tProceso = Timer()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Set HojaRango = Range(["A1"], ActiveCell.SpecialCells(xlLastCell))
NumFil = HojaRango.Rows.Count
NumCol = HojaRango.Columns.Count + 1
Cells(1, NumCol).Value = 1
Range(Cells(1, NumCol), Cells(NumFil, NumCol)).DataSeries Rowcol:=xlColumns, _
Type:=xlLinear, Date:=xlDay, Step:=1, Trend:=False
Set HojaRango = Nothing
Set HojaRango = Range(["A1"], ActiveCell.SpecialCells(xlLastCell))
With ActiveSheet.Sort
.SortFields.Clear
.SortFields.Add Key:=Range("E" & "1" & ":" & "E" & NumFil), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange HojaRango
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'Para conservar una única fila de cabeceros en fila 1.
filaDesde = ActiveSheet.Range("D:D").Find("Soc.").Row + 1
Range("A" & filaDesde & ":A" & NumFil).EntireRow.Delete
With ActiveSheet.Sort
.SortFields.Clear
.SortFields.Add Key:=Range(Cells(1, NumCol), Cells(NumFil, NumCol)), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange HojaRango
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Cells(1, NumCol).EntireColumn.Delete
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
MsgBox "Tiempo utilizado = " & (Timer() - tProceso) & " segundos"
End Sub
Nota:
¿Tal vez yo esté quitando datos que tú necesitas?