D
Dan E
This sub, which gives a "Run-time error '13': Type mismatch", is meant to
put overtime for a 2-week period in the BB column, for all rows that have an
X in the AT column. Hours for the 2 weeks are in AW and AX, and overtime is
anything over 40 for each week. I cannot figure out why this doesn't run -
all help and suggestions gratefully received.
TIA,
Dan
_____________________________
Sub ALL_OT()
Dim oRow As Range
Dim cell As Range
On Error GoTo ws_next4
For Each oRow In ActiveSheet.UsedRange.Rows
If Cells(oRow.Row, "AT").Value = "X" Then
Cells(oRow.Row, "BB").Value = 0
If Cells(oRow.Row, "AW").Value > 40 Then
Cells(oRow.Row, "BB").Value = Cells(oRow.Row, "AW").Value -
40
End If
If Cells(oRow.Row, "AX").Value > 40 Then
Cells(oRow.Row, "BB").Value = (Cells(oRow.Row, "BB").Value +
_
(Cells(oRow.Row, "AX").Value - 40))
End If
End If
ws_next4:
Next oRow
End Sub
________________________
put overtime for a 2-week period in the BB column, for all rows that have an
X in the AT column. Hours for the 2 weeks are in AW and AX, and overtime is
anything over 40 for each week. I cannot figure out why this doesn't run -
all help and suggestions gratefully received.
TIA,
Dan
_____________________________
Sub ALL_OT()
Dim oRow As Range
Dim cell As Range
On Error GoTo ws_next4
For Each oRow In ActiveSheet.UsedRange.Rows
If Cells(oRow.Row, "AT").Value = "X" Then
Cells(oRow.Row, "BB").Value = 0
If Cells(oRow.Row, "AW").Value > 40 Then
Cells(oRow.Row, "BB").Value = Cells(oRow.Row, "AW").Value -
40
End If
If Cells(oRow.Row, "AX").Value > 40 Then
Cells(oRow.Row, "BB").Value = (Cells(oRow.Row, "BB").Value +
_
(Cells(oRow.Row, "AX").Value - 40))
End If
End If
ws_next4:
Next oRow
End Sub
________________________