#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default if macro

cell a1 can have to possible values, 1 or 2. if a1=1, when i hit a button i want macro1 to go. if a1=2, when i hit the same button i want macro2 to go. is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default if macro

Tie Macro1 to the button

Sub Macro1()
If Activesheet.Range("A1").Value =1 Then
Macro2
ElseIf Activesheet.Range("A1").Value = 2 Then
Macro3
End If
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"choice" wrote in message
...
cell a1 can have to possible values, 1 or 2. if a1=1, when i hit a button

i want macro1 to go. if a1=2, when i hit the same button i want macro2 to
go. is this possible?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default if macro

An easy way is to call the same macro and test for 1 or 2 in this cell and
continue execution accordingly.

If Range("A1") = 1 then
macro1
ElseIf Range("A1") = 2 then
macro2
Else
MsgBox "A1 must be 1 or 2"
End If

TH

On 4/21/04 16:01, in article
, "choice"
wrote:

cell a1 can have to possible values, 1 or 2. if a1=1, when i hit a button i
want macro1 to go. if a1=2, when i hit the same button i want macro2 to go. is
this possible?


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 recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 01:09 AM.

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

About Us

"It's about Microsoft Excel"