ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to start a makro (https://www.excelbanter.com/excel-worksheet-functions/204160-how-start-makro.html)

Johnny

How to start a makro
 
When I delete a name in a cell I have made a makro that is doing some
"cleening up". How can I make this makro start when the name is deleted? Or
do I really need a button to make the makro starting?

NoodNutt

How to start a makro
 
G'day John

You could use the Worksheet_Change event.

Something like

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("YourRange")) Is Nothing Then
Application.Run "YourMacro"
End If
End Sub

("YourRange") can be multiple Cells ("A1" , "K20", Z1:Z100)

HTH
Mark.



MuppetMan

How to start a makro
 
you need to put some code in the worksheet "CHANGE" event...

something like this -

Private Sub Worksheet_Change(ByVal Target As Range)

Call MY_MACRO 'where MY_MACRO is the name of your "Clean up" macro.

End Sub

This code MUST go in the worksheet_Change event for the actual sheet
you are working on.

Muppet Man.
On Sep 26, 7:08*pm, johnny wrote:
When I delete a name in a cell I have made a makro that is doing some
"cleening up". How can I make this makro start when the name is deleted? Or
do I really need a button to make the makro starting?



Johnny

How to start a makro
 
I finally make the makro start and function in a way... But I want it to
start only when the value in the cell is deleted, how can I make that
happend?

MuppetMan skrev:

you need to put some code in the worksheet "CHANGE" event...

something like this -

Private Sub Worksheet_Change(ByVal Target As Range)

Call MY_MACRO 'where MY_MACRO is the name of your "Clean up" macro.

End Sub

This code MUST go in the worksheet_Change event for the actual sheet
you are working on.

Muppet Man.
On Sep 26, 7:08 pm, johnny wrote:
When I delete a name in a cell I have made a makro that is doing some
"cleening up". How can I make this makro start when the name is deleted? Or
do I really need a button to make the makro starting?




Gord Dibben

How to start a makro
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = "" Then
macroname
End If
End Sub


Gord Dibben MS Excel MVP

On Sat, 27 Sep 2008 09:11:00 -0700, johnny
wrote:

I finally make the makro start and function in a way... But I want it to
start only when the value in the cell is deleted, how can I make that
happend?

MuppetMan skrev:

you need to put some code in the worksheet "CHANGE" event...

something like this -

Private Sub Worksheet_Change(ByVal Target As Range)

Call MY_MACRO 'where MY_MACRO is the name of your "Clean up" macro.

End Sub

This code MUST go in the worksheet_Change event for the actual sheet
you are working on.

Muppet Man.
On Sep 26, 7:08 pm, johnny wrote:
When I delete a name in a cell I have made a makro that is doing some
"cleening up". How can I make this makro start when the name is deleted? Or
do I really need a button to make the makro starting?





Johnny

How to start a makro
 
Everythings works just fine now, thanx everyone!!

Gord Dibben skrev:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = "" Then
macroname
End If
End Sub


Gord Dibben MS Excel MVP

On Sat, 27 Sep 2008 09:11:00 -0700, johnny
wrote:

I finally make the makro start and function in a way... But I want it to
start only when the value in the cell is deleted, how can I make that
happend?

MuppetMan skrev:

you need to put some code in the worksheet "CHANGE" event...

something like this -

Private Sub Worksheet_Change(ByVal Target As Range)

Call MY_MACRO 'where MY_MACRO is the name of your "Clean up" macro.

End Sub

This code MUST go in the worksheet_Change event for the actual sheet
you are working on.

Muppet Man.
On Sep 26, 7:08 pm, johnny wrote:
When I delete a name in a cell I have made a makro that is doing some
"cleening up". How can I make this makro start when the name is deleted? Or
do I really need a button to make the makro starting?






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

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