yabbadabba
New Member
- Joined
- Mar 26, 2011
- Messages
- 20
Hi guys, i'm having trouble with my code and the if statement.My code works fine until it gets to to the lines highlighted in red. any help would be appreciated.thanx
Private Sub ListBox3_Click()
Sheets("TimeSheet").Range("E7") = ListBox3.Value
Dim Inp, Outp
Dim Rng As Range
Inp = ListBox3.Value
With Sheets("Rates").Range("A:B")
Set Rng = .Find(what:=Inp, after:=.Cells(.Rows.Count, 1), LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Outp = Rng.Offset(0, 1).Select
If Sheets("TimeSheet").Range("E7") = "Day Shift" Then
Sheets("TimeSheet").Range("F7") = Val(ActiveCell.Value * 8) + Sheets("Rates").Range("B3") * Val(TextBox48.Value) + Sheets("Rates").Range("B4") * Val(TextBox38.Value)
Else
If Sheets("TimeSheet").Range("E7") = "Afternoon Shift" Then
Sheets("TimeSheet").Range("F7") = Val(ActiveCell.Value * 8) + Sheets("Rates").Range("B6") * Val(TextBox48.Value) + Sheets("Rates").Range("B7") * Val(TextBox38.Value)
End If
End If
End If
End With
End Sub
Private Sub ListBox3_Click()
Sheets("TimeSheet").Range("E7") = ListBox3.Value
Dim Inp, Outp
Dim Rng As Range
Inp = ListBox3.Value
With Sheets("Rates").Range("A:B")
Set Rng = .Find(what:=Inp, after:=.Cells(.Rows.Count, 1), LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Outp = Rng.Offset(0, 1).Select
If Sheets("TimeSheet").Range("E7") = "Day Shift" Then
Sheets("TimeSheet").Range("F7") = Val(ActiveCell.Value * 8) + Sheets("Rates").Range("B3") * Val(TextBox48.Value) + Sheets("Rates").Range("B4") * Val(TextBox38.Value)
Else
If Sheets("TimeSheet").Range("E7") = "Afternoon Shift" Then
Sheets("TimeSheet").Range("F7") = Val(ActiveCell.Value * 8) + Sheets("Rates").Range("B6") * Val(TextBox48.Value) + Sheets("Rates").Range("B7") * Val(TextBox38.Value)
End If
End If
End If
End With
End Sub