Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro if certain cell change

Dear All,

Can we only run a macro if certain cell change?

Eg. If contain for C4 change then run the macro.

If yes, kindly guide me on setting up the function?
Thank you.

Best Regards,
Kidd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Run Macro if certain cell change

One way,

Enter the following in the worksheet code window (right-click the worksheet tab
and choose View code (or similar)).

'----
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$4" Then
MsgBox "You changed " & Target.Address
End If
End Sub
'----

HTH
Anders Silvén


"Kidd" skrev i meddelandet
...
Dear All,

Can we only run a macro if certain cell change?

Eg. If contain for C4 change then run the macro.

If yes, kindly guide me on setting up the function?
Thank you.

Best Regards,
Kidd



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Run Macro if certain cell change

another way is

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, ActiveSheet.Range("c4")) Is Nothing
Then Exit Sub
'run your code
end sub

-----Original Message-----
One way,

Enter the following in the worksheet code window (right-

click the worksheet tab
and choose View code (or similar)).

'----
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$4" Then
MsgBox "You changed " & Target.Address
End If
End Sub
'----

HTH
Anders Silvén


"Kidd" skrev i meddelandet
...
Dear All,

Can we only run a macro if certain cell change?

Eg. If contain for C4 change then run the macro.

If yes, kindly guide me on setting up the function?
Thank you.

Best Regards,
Kidd



.

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 that will change the font of a cell if i change a value jk Excel Discussion (Misc queries) 2 July 29th 08 04:39 PM
Change the Color of a Cell through a Macro JakeShipley2008 Excel Discussion (Misc queries) 4 June 9th 08 05:57 PM
Fire Macro from Cell Change Slashman Excel Worksheet Functions 7 October 17th 06 04:08 AM
Macro on Cell change melafont Excel Discussion (Misc queries) 2 August 5th 06 10:39 PM
Macro to change cell color Patti F Excel Discussion (Misc queries) 2 April 28th 06 07:13 PM


All times are GMT +1. The time now is 08:49 AM.

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"