#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 109
Default MACRO?

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default MACRO?

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

"Neil Pearce" skrev i meddelelsen
...
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


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 109
Default MACRO?

Thanking-you kindly Per.

"Per Jessen" wrote:

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

"Neil Pearce" skrev i meddelelsen
...
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



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 109
Default MACRO?

Per,

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

Range("A1").Value

Any ideas?


Cheers,

Neil

"Per Jessen" wrote:

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

"Neil Pearce" skrev i meddelelsen
...
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



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default MACRO?

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

"Neil Pearce" skrev i meddelelsen
...
Per,

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

Range("A1").Value

Any ideas?


Cheers,

Neil

"Per Jessen" wrote:

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

"Neil Pearce" skrev i meddelelsen
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 02:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 10:31 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 06:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 01:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 04:38 PM


All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"