Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Trigger Macro on change in cell value

In my data validation I put the minimum and maximum values in the
spreadsheet rather than hard code them. The problem is if the end user
changes the minimum or maximum value I want to run a macro to reset the
messages to be displayed by the data validation message box.

What I want to do is trigger the macro if either value changes. Cell M8
holds the minimum, N8 holds the maximum value. Value is integer. So if
either of these numbers are change, how do I automatically run my macro?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Trigger Macro on change in cell value

Use the Worksheet_Change() event macro. See

http://cpearson.com/excel/events.htm

In article ,
"qwerty" wrote:

In my data validation I put the minimum and maximum values in the
spreadsheet rather than hard code them. The problem is if the end user
changes the minimum or maximum value I want to run a macro to reset the
messages to be displayed by the data validation message box.

What I want to do is trigger the macro if either value changes. Cell M8
holds the minimum, N8 holds the maximum value. Value is integer. So if
either of these numbers are change, how do I automatically run my macro?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Trigger Macro on change in cell value

OK - works perfectly for one cell. What is the most efficient way for
multiple cells?

"JE McGimpsey" wrote in message
...
Use the Worksheet_Change() event macro. See

http://cpearson.com/excel/events.htm

In article ,
"qwerty" wrote:

In my data validation I put the minimum and maximum values in the
spreadsheet rather than hard code them. The problem is if the end user
changes the minimum or maximum value I want to run a macro to reset the
messages to be displayed by the data validation message box.

What I want to do is trigger the macro if either value changes. Cell M8
holds the minimum, N8 holds the maximum value. Value is integer. So if
either of these numbers are change, how do I automatically run my macro?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Trigger Macro on change in cell value

Depends -

If the same action will occur for all cells, one way:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If Not Intersect(.Cells, Range("A1, B2")) Is Nothing Then
'do stuff here
End If
End With
End Sub

If different things should occur when each cell is changed, one way:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
Select Case .Cells.Address(False, False)
Case "A1"
'Do A1 Stuff
Case "B2"
'Do B2 Stuff
Case Else
'Do Nothing
End Select
End With
End Sub



In article ,
"qwerty" wrote:

OK - works perfectly for one cell. What is the most efficient way for
multiple cells?

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
Trigger Event on Format Change Zone[_3_] Excel Discussion (Misc queries) 4 August 25th 07 05:43 PM
Cell change to trigger Macro Sören_Marodören Excel Programming 2 April 11th 06 11:09 AM
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Trigger an event on Checkbox change James[_28_] Excel Programming 2 September 1st 04 08:31 PM


All times are GMT +1. The time now is 11:01 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"