G
Guest
I am a novice to Excel VBA and would like to be pointed in the right
direction to solving the problem I am having with the code below. I want to
use the For...Next i Loop for each Worksheet in my Workbook. For some reason
the For Each...Next sh Loop is not working for the worksheets I specified.
The code only works if I physically select each individual worksheet and run
it once per worksheet. PLEASE HELP!! HUGE THANKS IN ADVANCE!!
Sub NEW_COMPILE_SCHEDULES()
Dim sh As Worksheet
LastRow = Cells(65536, 1).End(xlUp).Row
For Each sh In Worksheets(Array("Engineering", "Graph Pro", "Metal Fab",
"Alum Ext"))
For i = LastRow To 5 Step -1
If Cells(i, 10).Font.ColorIndex = 15 Then
Cells(i, 1).EntireRow.Delete
ElseIf Cells(i, 10) = "" Then
Cells(i, 1).EntireRow.Delete
End If
Next i
Next sh
End Sub
direction to solving the problem I am having with the code below. I want to
use the For...Next i Loop for each Worksheet in my Workbook. For some reason
the For Each...Next sh Loop is not working for the worksheets I specified.
The code only works if I physically select each individual worksheet and run
it once per worksheet. PLEASE HELP!! HUGE THANKS IN ADVANCE!!
Sub NEW_COMPILE_SCHEDULES()
Dim sh As Worksheet
LastRow = Cells(65536, 1).End(xlUp).Row
For Each sh In Worksheets(Array("Engineering", "Graph Pro", "Metal Fab",
"Alum Ext"))
For i = LastRow To 5 Step -1
If Cells(i, 10).Font.ColorIndex = 15 Then
Cells(i, 1).EntireRow.Delete
ElseIf Cells(i, 10) = "" Then
Cells(i, 1).EntireRow.Delete
End If
Next i
Next sh
End Sub