ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Marco Help (https://www.excelbanter.com/excel-discussion-misc-queries/142496-marco-help.html)

looper

Marco Help
 
Hello
I have a text box with an assigned macro. I want th run two macros off of
the button. Which macro runs will depend on the location of the active cell.
User will have two options. If cell A1 active, button will run macro a. If
cell B1 active, button will run macro b.

Tank you

excelent

Marco Help
 
assign ur button to macro "Butt"

Sub Butt()
If ActiveCell.Address = "$A$1" Then Call a
If ActiveCell.Address = "$B$1" Then Call b
End Sub

Sub a()
MsgBox ("") & ActiveCell.Address
End Sub

Sub b()
MsgBox ("") & ActiveCell.Address
End Sub


"looper" skrev:

Hello
I have a text box with an assigned macro. I want th run two macros off of
the button. Which macro runs will depend on the location of the active cell.
User will have two options. If cell A1 active, button will run macro a. If
cell B1 active, button will run macro b.

Tank you


David McRitchie

Marco Help
 
Would suggest instead using an Event Macro, specifically a
double-click macro, and test the target address, column, or row.
http://www.mvps.org/dmcritchie/excel/event.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"looper" wrote in message ...
Hello
I have a text box with an assigned macro. I want th run two macros off of
the button. Which macro runs will depend on the location of the active cell.
User will have two options. If cell A1 active, button will run macro a. If
cell B1 active, button will run macro b.

Tank you





All times are GMT +1. The time now is 06:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com