Greater than, less than statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a nested if statement, I am trying to write, if a1 greater than 500
but less than 999, then do X. I can’t seem to get that part to work. Any
Ideas ???
Thanks
 
give this a try

Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
If ws.Range("A1") > 500 And ws.Range("A1") < 999 Then
MsgBox "ok"
Else
MsgBox "not ok"
End If
End Sub
 
=if(and(a1>500,a1<999),"X","Y")

But doing something is beyond what formulas can do.
 
Are you trying to do these two calculations together or separate?
if A1>500 and A1 <999 then do X
works for me,
but 500<A1<999 doesn't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top