newbe to VBA

Timboray

New Member
Joined
Sep 8, 2011
Messages
11
Im running program and the relational operator seems to overlap

Option Explicit
Private Sub Clear_Click()
Cells(7, 6) = ""
Cells(8, 6) = ""
Cells(9, 6) = ""
Cells(10, 6) = ""
Cells(11, 6) = ""
End Sub
Private Sub CommCalc_Click()
'everyones base pay is 1000.00
'commission is 0
' sell more than 100000 - commission is 3%
' sell more than 200000 - commission is 4%
' sell more than 300000 - commission is 4.5%

'user enters name ans sales amount
Cells(7, 6) = ""
Cells(8, 6) = ""
Cells(9, 6) = ""
Cells(10, 6) = ""
Cells(11, 6) = ""

Const curBASE_PAY As Currency = 1000
Dim curComsn As Currency
Dim curTotSales As Currency
Dim curTotal As Currency

Call Clear_Click

'input-------------------------------------------------
Name = InputBox("Name?")
curTotSales = InputBox("Amount of Total Sales?")

'processing--------------------------------------------

If (curTotSales < 100000) Then
curComsn = curTotSales * 0
curTotal = curBASE_PAY + curComsn
End If
If (curTotSales > 100000 < 200000) Then
curComsn = curTotSales * 0.03
curTotal = curBASE_PAY + curComsn


End If

If (curTotSales > 200000 < 300000) Then
curComsn = curTotSales * 0.04
curTotal = curBASE_PAY + curComsn

End If


'If (intQty >= 10) Then
' curTotal = curTotal * 0.9
'End If


'output-----------------------------------------------

Cells(7, 6) = Name
Cells(8, 6) = curTotSales
Cells(9, 6) = curBASE_PAY
Cells(10, 6) = curComsn
Cells(11, 6) = curTotal

End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
It should be like this

Code:
If curTotSales > 100000 and curTotSales < 200000) Then

Please use code tags when posting code.
 
Upvote 0
Ok will post in code box next time I didn't know to do so. Thanks for the quick help that did it...Thanks Much!
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,256
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top