Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looking for Cell_Change Event
I have a worksheet that has several cells that users will
change. I am currently using the Private Sub Worksheet_Change() function to activate the code. This function runs the code anytime ANY CELL is modified. I'm looking for a similar event funtion that only runs the code when a certain cell is modified. For instance, when A1 is changed I want the function Name () to run. When A2 is changed I want the function Group() to run. However, I don't want Name() to run when A2 is changed or Group() to run when A1 is changed as would happen using Worksheet_Change(). Any suggestions??? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looking for Cell_Change Event
Hi Mike,
You're kind of out of luck with that, as there are no more specific Change events. However, you can do a simple check in the Worksheet_Change event to see which cell has changed: Private Sub Worksheet_Change(ByVal Target As Range) If Not Application.Intersect(Target, _ Range("A1")) Is Nothing Then MsgBox "A1" End If If Not Application.Intersect(Target, _ Range("A2")) Is Nothing Then MsgBox "A2" End If End Sub The argument "Target" will contain a reference to the Range object that was changed. This should execute pretty quickly, so I doubt you'll notice any slowing due to it. -- Regards, Jake Marx www.longhead.com Mike wrote: I have a worksheet that has several cells that users will change. I am currently using the Private Sub Worksheet_Change() function to activate the code. This function runs the code anytime ANY CELL is modified. I'm looking for a similar event funtion that only runs the code when a certain cell is modified. For instance, when A1 is changed I want the function Name () to run. When A2 is changed I want the function Group() to run. However, I don't want Name() to run when A2 is changed or Group() to run when A1 is changed as would happen using Worksheet_Change(). Any suggestions??? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
event warning | Excel Discussion (Misc queries) | |||
event vba | Excel Worksheet Functions | |||
VBA Event | Excel Discussion (Misc queries) | |||
event | Excel Discussion (Misc queries) | |||
OnTime event not firing in Workbook_Open event procedure | Excel Programming |