Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Trapping Worksheet Target

I'm using the Worksheet.Change function to trigger a macro when a cell
changes. I'm specifying the right cell (Target.Address = $Col$Row)
but I can't get the darn thing to trigger. I want to see what address
is being passed in the If Target.Address.... line.

Using a breakpoint doesn't seem to work. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trapping Worksheet Target


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim i
Dim c
Dim a
i = Target.Row
c = Target.Column
a = Target.Address

End Sub


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Trapping Worksheet Target

Chuck, try using this code behind the worksheet you are trying to detect the
change in. I can only think you have the change event in the wrong place?

Private Sub Worksheet_Change(ByVal Target As Range)

MsgBox Target.Address

End Sub

Cheers
N

"Chuck Taylor" wrote in message
...
I'm using the Worksheet.Change function to trigger a macro when a cell
changes. I'm specifying the right cell (Target.Address = $Col$Row)
but I can't get the darn thing to trigger. I want to see what address
is being passed in the If Target.Address.... line.

Using a breakpoint doesn't seem to work. Any ideas?





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Trapping Worksheet Target

On Fri, 5 Dec 2003 07:41:25 -0000, "Nigel"
wrote:
Thanks for the tip. I don't know what I'm doing but the behavior of
the worksheet_change is really strange.

I'll put a breakpoint in the "If Target.address = $x$y" line and it
will never get triggered although I know the $x$y cells are changing.
That's really the problem I have - even with a breakpoint, I can't get
the breakpoint to ever be executed (so I can examine the
target.address).

Sometimes, however, it triggers all the time despite the
"Application.Eventenable=false" line I put in before calling the
macro. I'll hit break to stop the execution and then examine the
target.address from the debug line and it will have an address that
has no relation to what I'm doing.

I just can't get consistent execution.

Chuck, try using this code behind the worksheet you are trying to detect the
change in. I can only think you have the change event in the wrong place?

Private Sub Worksheet_Change(ByVal Target As Range)

MsgBox Target.Address

End Sub

Cheers
N


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Trapping Worksheet Target

Chuck

Suggest you post the code you have for everyone to review

Cheers
N

"Chuck Taylor" wrote in message
...
On Fri, 5 Dec 2003 07:41:25 -0000, "Nigel"
wrote:
Thanks for the tip. I don't know what I'm doing but the behavior of
the worksheet_change is really strange.

I'll put a breakpoint in the "If Target.address = $x$y" line and it
will never get triggered although I know the $x$y cells are changing.
That's really the problem I have - even with a breakpoint, I can't get
the breakpoint to ever be executed (so I can examine the
target.address).

Sometimes, however, it triggers all the time despite the
"Application.Eventenable=false" line I put in before calling the
macro. I'll hit break to stop the execution and then examine the
target.address from the debug line and it will have an address that
has no relation to what I'm doing.

I just can't get consistent execution.

Chuck, try using this code behind the worksheet you are trying to detect

the
change in. I can only think you have the change event in the wrong

place?

Private Sub Worksheet_Change(ByVal Target As Range)

MsgBox Target.Address

End Sub

Cheers
N






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Trapping Worksheet Target

Since you asked for "any ideas", an untested one would be to use a message
box in the sub to display the target address.

Let us know if this works!

James Cox


"Chuck Taylor" wrote in message
...
I'm using the Worksheet.Change function to trigger a macro when a cell
changes. I'm specifying the right cell (Target.Address = $Col$Row)
but I can't get the darn thing to trigger. I want to see what address
is being passed in the If Target.Address.... line.

Using a breakpoint doesn't seem to work. Any ideas?



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
Editing the target worksheet zhj23 Excel Discussion (Misc queries) 3 June 27th 07 12:33 PM
Target cell reference moves when target is cut and pasted Illya Teideman Excel Discussion (Misc queries) 5 May 31st 07 11:34 AM
Excel VBA Target Worksheet change [email protected] Excel Discussion (Misc queries) 1 March 2nd 06 02:33 PM
Using VBA to create a new worksheet, and then target new worksheet brianproctorla Excel Discussion (Misc queries) 1 September 27th 05 12:50 AM
Trapping Events generated by a Worksheet debartsa Excel Programming 3 November 28th 03 01:42 PM


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