MACRO?

  • Thread starter Thread starter Neil Pearce
  • Start date Start date
N

Neil Pearce

All,

Is there anything obviously wrong with the below? Only it always runs
applictaion three regardless of the value in A1.

Sub CLEARall()

If A1 = 1 Then
Application.Run "One"
ElseIf A1 = 2 Then
Application.Run "Two"
Else: A1 = 3
Application.Run "Three"
End If


Thanking-you,

Neil
 
Hi

Look at this code.

Sub CLEARall()
Range("A1").Value
If Range("A1").Value= 1 Then
Application.Run "One"
ElseIf Range("A1").Value= 2 Then
Application.Run "Two"
ElseIf Range("A1").Value = 3 Then
Application.Run "Three"
End If
End Sub

Regards,
Per
 
Thanking-you kindly Per.

Per Jessen said:
Hi

Look at this code.

Sub CLEARall()
Range("A1").Value
If Range("A1").Value= 1 Then
Application.Run "One"
ElseIf Range("A1").Value= 2 Then
Application.Run "Two"
ElseIf Range("A1").Value = 3 Then
Application.Run "Three"
End If
End Sub

Regards,
Per
 
Per,

The Code returns "invalid use of property" and stops at value on...

Range("A1").Value

Any ideas?


Cheers,

Neil
 
My fault,

I edited the code after I've pasted it to the news reader.
Just remove the line mentioned, and it will be fine...

regards,
Per
 

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