Thread: GREATER THAN
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
CB Hamlyn CB Hamlyn is offline
external usenet poster
 
Posts: 24
Default GREATER THAN

You've got the syntax correct.

If it doesn't work perhaps the variable isn't numeric or perhaps it's < or =
0?

As a simple example, the below declares intTestNumber as an Integer then
sets it to the value of Cell A1. Next it tests to see if it's greater than
0. If it is, it sets Cell A1 back to Zero.

Dim intTestNumber As Integer
intTestNumber = Range("A1").Value
if intTestNumber 0 Then Range("A1").Value = 0

Hope that helps.
CB Hamlyn

wrote in message
oups.com...
Hi,

Can anyone help me with some code, iwant to use an if statement,
declaring that if a varible is greater then 0 then do my then
statement. I cannot seem to get it right

i am using

if variable name 0 then my action