ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Greater than, less than statement (https://www.excelbanter.com/excel-programming/383240-greater-than-less-than-statement.html)

DP7

Greater than, less than statement
 
I have a nested if statement, I am trying to write, if a1 greater than 500
but less than 999, then do X. I cant seem to get that part to work. Any
Ideas ???
Thanks


Gary Keramidas

Greater than, less than statement
 
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


--


Gary


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




Gary''s Student

Greater than, less than statement
 
If x 500 And x < 999 Then
MsgBox ("IN THERE")
End If
--
Gary's Student
gsnu200706


"DP7" wrote:

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


Dave Peterson

Greater than, less than statement
 
=if(and(a1500,a1<999),"X","Y")

But doing something is beyond what formulas can do.

DP7 wrote:

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


--

Dave Peterson

Keith

Greater than, less than statement
 
Are you trying to do these two calculations together or separate?
if A1500 and A1 <999 then do X
works for me,
but 500<A1<999 doesn't.

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




Dave Peterson

Greater than, less than statement
 
Oopsie!

This is a programming newsgroup question.

Sorry.

Dave Peterson wrote:

=if(and(a1500,a1<999),"X","Y")

But doing something is beyond what formulas can do.

DP7 wrote:

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


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com