Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro on action
Hi,
This is probably a simple one but I just cant find the answer. How does one kick off a macro by a specific cell being altered (eg data keyed into it, change of font etc) -- Andrew |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro on action
To access the events that are generated on a sheet do this...
Right Click the tab of the sheet - Select View Code Just above the code window you will see the word general Change General to Worksheet Just to the right of Worksheet is a drop down list of all of the events that you can make your code respond to. Note that when you select the event a code procedure is created for you automatically... Easy as that. Some of the procedures will have arguments like Target. Target is the cell you just changed or selected or... HTH "Andrew" wrote: Hi, This is probably a simple one but I just cant find the answer. How does one kick off a macro by a specific cell being altered (eg data keyed into it, change of font etc) -- Andrew |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro on action
Hi Jim,
Thanks for this. It has helped but as soon as I select the cell it starts the macro, I want to action the macro IF AND ONLY IF it has changed. Below is what I have so far... Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Address = "$C$3" Then MsgBox ("Cursor has been placed on cell C3.") End If End Sub "Jim Thomlinson" wrote: To access the events that are generated on a sheet do this... Right Click the tab of the sheet - Select View Code Just above the code window you will see the word general Change General to Worksheet Just to the right of Worksheet is a drop down list of all of the events that you can make your code respond to. Note that when you select the event a code procedure is created for you automatically... Easy as that. Some of the procedures will have arguments like Target. Target is the cell you just changed or selected or... HTH "Andrew" wrote: Hi, This is probably a simple one but I just cant find the answer. How does one kick off a macro by a specific cell being altered (eg data keyed into it, change of font etc) -- Andrew |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro on action
Hi,
replace If ActiveCell.Address = "$C$3" Then with If Target.Address = "$C$3" Then Hth, OJ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro on action
Hi,
replace If ActiveCell.Address = "$C$3" Then with If Target.Address = "$C$3" Then Hth, OJ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro on action
you slected the wrong event the. the selection change fires whenever you
select a cell. the change event fires when you enter a new value try this Private Sub Worksheet_Change(ByVal Target As Range) If ActiveCell.Address = "$C$3" Then MsgBox Target.Value, , "New Value in " & Target.Address End If End Sub "Andrew" wrote: Hi Jim, Thanks for this. It has helped but as soon as I select the cell it starts the macro, I want to action the macro IF AND ONLY IF it has changed. Below is what I have so far... Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Address = "$C$3" Then MsgBox ("Cursor has been placed on cell C3.") End If End Sub "Jim Thomlinson" wrote: To access the events that are generated on a sheet do this... Right Click the tab of the sheet - Select View Code Just above the code window you will see the word general Change General to Worksheet Just to the right of Worksheet is a drop down list of all of the events that you can make your code respond to. Note that when you select the event a code procedure is created for you automatically... Easy as that. Some of the procedures will have arguments like Target. Target is the cell you just changed or selected or... HTH "Andrew" wrote: Hi, This is probably a simple one but I just cant find the answer. How does one kick off a macro by a specific cell being altered (eg data keyed into it, change of font etc) -- Andrew |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro to action formula | New Users to Excel | |||
Excell copy action pauses for 15 second for the smallest action | Excel Discussion (Misc queries) | |||
I can't get a macro action to start from the current field? | Excel Discussion (Misc queries) | |||
I can't get a macro action to start from the current field? | Excel Discussion (Misc queries) | |||
on particular action run a macro | Excel Discussion (Misc queries) |