Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Running a macro on action

Hi,
replace
If ActiveCell.Address = "$C$3" Then
with
If Target.Address = "$C$3" Then

Hth,
OJ

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Running a macro on action

Hi,
replace
If ActiveCell.Address = "$C$3" Then
with
If Target.Address = "$C$3" Then

Hth,
OJ



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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
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 to action formula pvkutty New Users to Excel 1 February 13th 10 02:01 PM
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
I can't get a macro action to start from the current field? Paul Keeling Excel Discussion (Misc queries) 1 June 21st 06 02:57 PM
I can't get a macro action to start from the current field? Paul Keeling Excel Discussion (Misc queries) 0 June 21st 06 02:53 PM
on particular action run a macro Jelinek Excel Discussion (Misc queries) 1 February 3rd 06 01:21 PM


All times are GMT +1. The time now is 02:52 PM.

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"