Code:
For Each nP In Range(Cells(1, 14), Cells(cntRowsN, 14))
[COLOR=#008000]' E-H-S INCIDENT TALLY[/COLOR]
[COLOR=#008000]' COPY THE ROWS IN THE "EHS" COLUMN (ON THE ANALYTICS SHEET) AND PASTE ONTO THE TOTAL COLUMN (A2) ON THE "REPORTS" WORKSHEET:[/COLOR]
If cntRowsN >= 1 Then
[COLOR=#008000] 'copies just the rows in column F and pastes them on the REPORTS worksheet starting with cell A2.[/COLOR]
ActiveWorkbook.Worksheets("ANALYTICS").Activate
ActiveWorkbook.Worksheets("ANALYTICS").Range(Cells(1, 14), Cells(15, 14)).Select
Selection.Copy
ActiveWorkbook.Worksheets("REPORTS").Activate
ActiveWorkbook.Worksheets("REPORTS").Range("J2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWorkbook.Worksheets("ANALYTICS").Activate
Exit For
End If
Next
The problem I am having is that if 'cntRowsN' is 0, then it exits the entire sub...
but what I need it to do is if cntRowsN is zero just to exit this one procedure and go on to the next event (which is just like the above code but for another variable )
here is the next bit of code that follows the code posted above...(and there are 4 other ones just like this one that it needs to run through but its skipping all of them and just exiting the entire sub)
Code:
For Each lP In Range(Cells(1, 12), Cells(cntRowsL, 12))
[COLOR=#008000]' INTERNAL SEATEX INCIDENT TALLY[/COLOR]
[COLOR=#008000]' COPY THE ROWS IN THE "SEATEX INTERNAL" COLUMN (ON THE ANALYTICS SHEET) AND PASTE ONTO THE TOTAL COLUMN (H2) ON THE "REPORTS" WORKSHEET:[/COLOR]
If cntRowsL >= 1 Then
[COLOR=#008000] 'copies just the rows in column F and pastes them on the REPORTS worksheet starting with cell H2.[/COLOR]
ActiveWorkbook.Worksheets("ANALYTICS").Activate
ActiveWorkbook.Worksheets("ANALYTICS").Range(Cells(1, 12), Cells(15, 12)).Select
Selection.Copy
ActiveWorkbook.Worksheets("REPORTS").Activate
ActiveWorkbook.Worksheets("REPORTS").Range("H2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWorkbook.Worksheets("ANALYTICS").Activate
Exit For
End If
Next