S
stewart
When this code is run i get the end if without block if error, but i
don't see what i am doing wrong. It highlights the very first "if"
statement
Private Sub btnSubmit_Click()
Sheets("rewards tracker").Activate
If Left(cmbDate.Value, 3) = "Sun" Then For i = 1 To txtQty.Value Step
1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(3) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Mon" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(8) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Tue" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(13) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Wed" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(18) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Thu" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 108).Select
Selection.Cells(3) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Fri" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 108).Select
Selection.Cells(8) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Sat" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 108).Select
Selection.Cells(13) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
End If
End Sub
don't see what i am doing wrong. It highlights the very first "if"
statement
Private Sub btnSubmit_Click()
Sheets("rewards tracker").Activate
If Left(cmbDate.Value, 3) = "Sun" Then For i = 1 To txtQty.Value Step
1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(3) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Mon" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(8) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Tue" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(13) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Wed" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 4).Select
Selection.Cells(18) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Thu" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 108).Select
Selection.Cells(3) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Fri" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 108).Select
Selection.Cells(8) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
ElseIf Left(cmbDate.Value, 3) = "Sat" Then For i = 1 To txtQty.Value
Step 1
txtholder.Value = Me.Controls("txtNum" & i).Value
Rows(txtholder.Value + 108).Select
Selection.Cells(13) = Me.Controls("txtRew" & i).Value
ActiveCell.Offset(0, 1) = Me.Controls("txtTot" & i).Value
ActiveCell.Offset(0, 3) = Me.Controls("txtNew" & i).Value
Next i
End If
End Sub