Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
DoctorG
 
Posts: n/a
Default Worksheet Change event

I want to execute a specific routine whenever a cell of a certain column
changes.

All is OK if I press enter and the cursor is programmed to stay in the cell.
Then I check the ActiveCell.Column property and execute the code. I have a
problem if the user leaves the cell i.e. with a right or left arrow and the
active column upon execution of the Worksheet Change routine is different to
the one I wish to monitor.

Is there a way to know the address of the cell that triggered the Change
Event instead of the current/active cell ?
  #2   Report Post  
Posted to microsoft.public.excel.misc
DoctorG
 
Posts: n/a
Default Worksheet Change event

Sorry for posting this in the General section instead of the Programming
one....
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Worksheet Change event

You could use the Worksheet_change event and Target.

Target will tell you what cell was just changed by the user:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a1:a100")) Is Nothing Then Exit Sub

Msgbox "User changed: " & target.address

End Sub

If you want to read more about these kinds of events:

Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

DoctorG wrote:

I want to execute a specific routine whenever a cell of a certain column
changes.

All is OK if I press enter and the cursor is programmed to stay in the cell.
Then I check the ActiveCell.Column property and execute the code. I have a
problem if the user leaves the cell i.e. with a right or left arrow and the
active column upon execution of the Worksheet Change routine is different to
the one I wish to monitor.

Is there a way to know the address of the cell that triggered the Change
Event instead of the current/active cell ?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Worksheet Change event

Use Target.column, not activecell. I assume that you are using the worksheet
change event.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"DoctorG" wrote in message
...
I want to execute a specific routine whenever a cell of a certain column
changes.

All is OK if I press enter and the cursor is programmed to stay in the

cell.
Then I check the ActiveCell.Column property and execute the code. I have a
problem if the user leaves the cell i.e. with a right or left arrow and

the
active column upon execution of the Worksheet Change routine is different

to
the one I wish to monitor.

Is there a way to know the address of the cell that triggered the Change
Event instead of the current/active cell ?



  #5   Report Post  
Posted to microsoft.public.excel.misc
DoctorG
 
Posts: n/a
Default Worksheet Change event

Thank you both!! You 've been most helpful.
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
Worksheet Change event LAF Excel Discussion (Misc queries) 3 January 4th 06 03:08 AM
Using this Automatic Resizing Macro with Worksheet Change [email protected] Excel Discussion (Misc queries) 0 December 19th 05 04:57 PM
Worksheet Change Event DCSwearingen Excel Discussion (Misc queries) 1 October 10th 05 11:25 PM
change source worksheet neeraj Excel Discussion (Misc queries) 2 September 21st 05 11:16 PM
How to change the right-to-left worksheet to left-to-right workshe RAMA Excel Discussion (Misc queries) 1 July 4th 05 02:57 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"