If Then

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

Guest

I have a macro called "create" I want repeated until the value of A20 is not
"No". I took a few wild guesses (see below). I am prolly not using A20, =
and "No" correctly. Also, instead of "=", what could I use for "not equal"?
I appreciate the help.

If ("A20") = "No" Then
Application.Run "'Crew 2007 August 1 Randoms.xls'!create"
End If

If ("A20") = "No" Then Application.Run "'Crew 2007 August 1
Randoms.xls'!create"
 
If Range("A20") = "No" Then

Not equal is <>

Greater than is >

Less than is <

Regards,

OssieMac
 
Thanks. I used to use <> in ye olde BASIC days. Glad to know it still
works. My macro works perfectly now. Thanks again.
 
Not neccessary, but I like to assign the complete function name to a shorter
string variable.

Sub Demo()
Const Fx As String = "'Crew 2007 August 1 Randoms.xls'!create"
Const strNo As String = "No"

Do While Range("A20") = strNo
Run Fx
Loop
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

Back
Top