Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default expected sub, function, or property

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default expected sub, function, or property

Josh,

Change

payamt - intaccru = payaft_int

to

payaft_int = payamt - intaccru

HTH,
Bernie
Excel MVP


"Josh" wrote in message ...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default expected sub, function, or property

looks like your code is backwards

If payamt = intaccru Then
payamt -intaccru = payaft_int
Else
intaccru -payamt = Cells("e17").FormulaR1C1 = nbalance
End If


If payamt = intaccru Then
payaft_int = payamt - intaccru
Else
nbalance = intaccru -payamt
Cells("e17").Value = nbalance
End If

Regards,
Tom Ogilvy


"Josh" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default expected sub, function, or property


thanks guys, i realized that after i posted that, i
should have know!

thanks again,
Josh
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Value function not working as expected in Excel 2007 bdevier Excel Worksheet Functions 1 November 28th 08 05:24 PM
MATCH function not matching as expected Peter Excel Worksheet Functions 10 October 30th 07 11:24 PM
Average function not returning expected result gja63 Excel Discussion (Misc queries) 4 August 28th 07 12:36 AM
Hyperlink Function not working as expected Hari Prasadh Excel Discussion (Misc queries) 2 April 16th 05 01:23 PM
compile error: expected variable or function MMM Excel Discussion (Misc queries) 3 December 24th 04 03:11 PM


All times are GMT +1. The time now is 11:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"