J
Josh
please help me figure out what i am doing wrong, i know
that i need to pull the variables from the worksheet, and
then use the three if/thens at the bottom, which will
then output back to the worksheet. i keep getting
a "expected sub, function or property" at the beginning
of the first if/then, what i am doing wrong?
thanks,
Josh
Private Sub CommandButton3_Click()
Dim payamt As Integer
payamt = Worksheets("Sheet1").Range("d14").Value
Dim intaccru As Integer
intaccru = Worksheets("Sheet1").Range("d17").Value
Dim costs As integer
costs = Worksheets("Sheet1").Range("c8").Value
Dim obalance As integer
obalance = Worksheets("Sheet1").Range("c4").Value
Dim nbalance As integer
Dim payaft_cost As integer
Dim payaft_int As integer
If payamt >= intaccru Then
payamt -intaccru = payaft_int
Else
intaccru -payamt = Cells("e17").FormulaR1C1 = nbalance
End If
If payaft_int >= costs Then
costs -payaft_int = payaft_cost
Else
costs -payaft_int = Cells("e17").FormulaR1C1 = nbalance
End If
If payaft_cost > 0 Then
obalance -payaft_cost = Cells("e17").FormulaR1C1 =
nbalance
Else
obalance = nbalance
End If
End Sub
that i need to pull the variables from the worksheet, and
then use the three if/thens at the bottom, which will
then output back to the worksheet. i keep getting
a "expected sub, function or property" at the beginning
of the first if/then, what i am doing wrong?
thanks,
Josh
Private Sub CommandButton3_Click()
Dim payamt As Integer
payamt = Worksheets("Sheet1").Range("d14").Value
Dim intaccru As Integer
intaccru = Worksheets("Sheet1").Range("d17").Value
Dim costs As integer
costs = Worksheets("Sheet1").Range("c8").Value
Dim obalance As integer
obalance = Worksheets("Sheet1").Range("c4").Value
Dim nbalance As integer
Dim payaft_cost As integer
Dim payaft_int As integer
If payamt >= intaccru Then
payamt -intaccru = payaft_int
Else
intaccru -payamt = Cells("e17").FormulaR1C1 = nbalance
End If
If payaft_int >= costs Then
costs -payaft_int = payaft_cost
Else
costs -payaft_int = Cells("e17").FormulaR1C1 = nbalance
End If
If payaft_cost > 0 Then
obalance -payaft_cost = Cells("e17").FormulaR1C1 =
nbalance
Else
obalance = nbalance
End If
End Sub