View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
William[_2_] William[_2_] is offline
external usenet poster
 
Posts: 227
Default IF statement in a macro

Hi...

Sub Test()
With ThisWorkbook.Sheets("Sheet1")
If .Range("B3") < 100 Then Exit Sub
'Your code here
MsgBox "Cell B3 is greater than 99"
End With
End Sub

-----
XL2003
Regards

William




"iamn94" wrote in message
...
Hello
New to macro writing so my question is pretty basic...

I want the macro to run only if the value of reference cell is less than a
certain return. For example, if the return is less than 30% run the
macro.
If the return is greater than or equal to 30% do not run the macro.

How do I go about doing this? The rest of my macro works fine, I just
need
to limit the range of its use.

Any and all help is appreciated.

Thanks
--
sd