excel Function/macro

L

Lance Masunaga

Is it possible to run a macro and a function
simultaneousely. Example. When you run a macro if a
certain cell has a specific data in it then do this, if
not then do something else? Is this even possible???
Thanks.
 
J

Jill

Lance,

of course. Have fun!

Sub doSomethingBasedOnCellValue()

i = Range("A1").Value
If i < 2 Then
MsgBox "It is less then 2", vbOKOnly, "I checked the
value of cell A1"
Else: MsgBox "It is " & i, vbOKOnly, "I checked the value
of cell A1"
End If

End Sub
 

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

Top