Hi all,
I am new to forum and VBA and having an issue with a macro i wrote and hoping someone can help me.
I have a basic for loop that works however as soon as it's finished excel slows right down and i cant click anything on the ribbon after.
Any suggestions welcome
Thanks
I am new to forum and VBA and having an issue with a macro i wrote and hoping someone can help me.
I have a basic for loop that works however as soon as it's finished excel slows right down and i cant click anything on the ribbon after.
Code:
Sub glenmor()'
' glenmor Macro
'
'
Application.ScreenUpdating = False
Dim lastRow As Long, lastRow2 As Long, r As Long
Sheets("Data").Select
lastRow = 4000
lastRow2 = 1
On Error Resume Next
For r = lastRow To 2 Step -1
If Range("B" & r).Value = "Glenmor" And Range("E" & r).Value = 0 Then
Rows(r).Copy Destination:=Worksheets("Glenmor").Range("A" & lastRow2 + 1)
lastRow2 = lastRow2 + 1
Else:
End If
Next r
Sheets("Results").Select
Application.ScreenUpdating = True
End Sub
Any suggestions welcome
Thanks