syntax error using if then condition1 and condition2

greegan

Well-known Member
Joined
Nov 18, 2009
Messages
644
Office Version
  1. 365
Platform
  1. Windows
I'm getting a syntax error for the first line of the following

Code:
If A1 > 17493 and <= 29805.50 Then
S = Application.Min(T4, ((A1 - 17493) * 0.032))

I don't understand why this is occurring.

-- g
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try

Code:
If Range("A1").Value > 17493 And Range("A1").Value <= 29805.5 Then
    s = Application.Min(Range("T4").Value, ((Range("A1").Value - 17493) * 0.032))
 
Upvote 0
That was fast. Thank you.
I should have identified this as vba code and A1 is Public as Currency. So is S and T4.

-- g
 
Upvote 0
In that case

Rich (BB code):
If A1 > 17493 And A1 <= 29805.5 Then
    s = Application.Min(T4, ((A1 - 17493) * 0.032))

I would avoid using variable names that look like cell addresses - very confusing.
 
Upvote 0
In that case

Rich (BB code):
If A1 > 17493 And A1 <= 29805.5 Then
    s = Application.Min(T4, ((A1 - 17493) * 0.032))

I would avoid using variable names that look like cell addresses - very confusing.


Thank you again. That should have been obvious :P
With the work that I'm doing, there are about 50 variables of which this had to be done. Working with the document these factors are originating, it would be even more confusing to use anything else, unfortunately.


Thank you for the help


-- g
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,854
Members
452,948
Latest member
UsmanAli786

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