ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Start macro automatic (https://www.excelbanter.com/excel-programming/375173-start-macro-automatic.html)

BFSWE

Start macro automatic
 
I want to know how to start a macro automatic. Not when I open Excel but when
I have an Excelfile open.
For example: If cell B3=1 then start macro "Start clock"

WhytheQ

Start macro automatic
 
I suspect you're hinting towards something like:

'============================
Private Sub Worksheet_SelectionChange(ByVal target As Range)

If target.Address = "$B$1" And target.Value = 1 Then
StartClock
End If

End Sub
============================

This will have to be put in the code module behind the relevent
worksheet (and I think the macro StartClock will need to have its scope
extended to Public if it is in a standard module)

Hope this helps
J


BFSWE wrote:

I want to know how to start a macro automatic. Not when I open Excel but when
I have an Excelfile open.
For example: If cell B3=1 then start macro "Start clock"



BFSWE

Start macro automatic
 
Hi WhytheQ.
Thank you for the answer. I will try it tomorrow.

"WhytheQ" skrev:

I suspect you're hinting towards something like:

'============================
Private Sub Worksheet_SelectionChange(ByVal target As Range)

If target.Address = "$B$1" And target.Value = 1 Then
StartClock
End If

End Sub
============================

This will have to be put in the code module behind the relevent
worksheet (and I think the macro StartClock will need to have its scope
extended to Public if it is in a standard module)

Hope this helps
J


BFSWE wrote:

I want to know how to start a macro automatic. Not when I open Excel but when
I have an Excelfile open.
For example: If cell B3=1 then start macro "Start clock"





All times are GMT +1. The time now is 10:17 PM.

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