PaulM2009
Board Regular
- Joined
- Feb 25, 2009
- Messages
- 51
Trying to figure out why this code isn't working. From what I can tell it is going through sheet 3 fine, but stopping and not going to 4 and so on.
Code:
Sub RoysterReport()
Dim LR As Long, ALR As Long, i As Long
Dim ws As Integer
Dim wsEnd As Integer
Application.ScreenUpdating = False
ws = 3
wsEnd = Worksheets.Count
Do Until ws = wsEnd
Worksheets(ws).Activate
LR = Worksheets(ws).Cells(65536, 1).End(xlUp).Row
For i = LR To 1 Step -1
If Cells(i, 18) > 0 Then
ALR = Worksheets("Incidents").Cells(65536, 1).End(xlUp).Row + 1
Range(Cells(i, 1), Cells(i, 31)).Copy Destination:=Worksheets("Incidents").Range("A" & ALR)
End If
Next i
ws = ws + 1
Loop
Worksheets(2).Activate
Range("b:b,d:q,s:ae").Select
Selection.Delete Shift:=xlToLeft
Range("a1").Activate
MsgBox "Done"
Application.ScreenUpdating = True
End Sub