Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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
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
event warning Andrew Excel Discussion (Misc queries) 2 August 3rd 09 06:18 AM
event vba irosh Excel Worksheet Functions 4 November 11th 08 09:25 AM
VBA Event Steve Excel Discussion (Misc queries) 2 October 14th 08 11:04 PM
event marker68 Excel Discussion (Misc queries) 1 April 4th 08 02:38 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


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