Hi guys, the following macro seems to run a little slow, is there anyway of making the code more efficient / run faster ?
Sub Adjust()
'
' Adjust Macro
'
' Keyboard Shortcut: Ctrl+a
'
Dim lr1 As Long
Dim lr2 As Long
Application.ScreenUpdating = False
Range("A2:AQ" & Range("A" & Rows.Count).End(xlUp).Row).Sort _
Key1:=Range("A2"), Order1:=xlAscending
lr1 = Cells(Rows.Count, "D").End(xlUp).Row
lr2 = Cells(Rows.Count, "AP").End(xlUp).Row
If lr1 < lr2 Then
Range("D2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ElseIf lr1 > lr2 Then
Range("AP2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ElseIf lr1 = lr2 Then
Range("A2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
End If
ActiveSheet.Calculate
Application.ScreenUpdating = False
End Sub
Sub Adjust()
'
' Adjust Macro
'
' Keyboard Shortcut: Ctrl+a
'
Dim lr1 As Long
Dim lr2 As Long
Application.ScreenUpdating = False
Range("A2:AQ" & Range("A" & Rows.Count).End(xlUp).Row).Sort _
Key1:=Range("A2"), Order1:=xlAscending
lr1 = Cells(Rows.Count, "D").End(xlUp).Row
lr2 = Cells(Rows.Count, "AP").End(xlUp).Row
If lr1 < lr2 Then
Range("D2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ElseIf lr1 > lr2 Then
Range("AP2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ElseIf lr1 = lr2 Then
Range("A2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
End If
ActiveSheet.Calculate
Application.ScreenUpdating = False
End Sub