How do I run a macro every time a certain cell changes its value?
Submitted by: AdministratorThere is an event called Worksheet_Change which is triggered when a value is entered (it will not fire when a formula result changes). One of the arguments to this event is 'Target' which is a reference to what changed. Since this event will occur whenever a value changes - you can use the target to see if it is the cell you are interested in:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C5")) Is Nothing Then
Exit Sub
Else
'The cell you are monitoring has changed!
'Do whatever you need to do...
End If
End Sub
Submitted by: Administrator
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C5")) Is Nothing Then
Exit Sub
Else
'The cell you are monitoring has changed!
'Do whatever you need to do...
End If
End Sub
Submitted by: Administrator
Read Online Microsoft Excel Job Interview Questions And Answers
Top Microsoft Excel Questions
☺ | What are Excel Spreadsheet Number Formats? |
☺ | Using Excel is there a way to close all open Excel files at once instead of closing them one at a time? |
☺ | How do I combine different chart types into my Excel spreadsheet? |
☺ | In MS Access, the long and short date option does not show 4 digit years. How do I achieve the mm/dd/yyyy format? |
☺ | How to Change the Sheet Tab Color of Excel Spreadsheets? |
Top Application Program Categories
☺ | AutoCAD Interview Questions. |
☺ | Microsoft Office Interview Questions. |
☺ | Microsoft Outlook Interview Questions. |
☺ | Microsoft Excel Interview Questions. |
☺ | WPF Interview Questions. |