I'm attempting to loop thru each sheet in an excel workbook. My code is only running thru the first sheet and it does not recognize where the last row is. Any help would be greatly appreciated.
Private Sub calculateValue()
For i = 2 To Rows.Count
If Cells(i, 4).Value < 10 Then
Cells(i, 6).Value = 20
End If
If Cells(i, 4).Value > 9 And Range("D2").Value < 40 Then
Cells(i, 6).Value = 70
End If
If Cells(i, 4).Value > 39 Then
Cells(i, 6).Value = 120
End If
If Cells(i, 4).Value = Empty Then Exit For
Next i
Cells(i, 6).Value = ""
End Sub