Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Editing the target worksheet | Excel Discussion (Misc queries) | |||
Target cell reference moves when target is cut and pasted | Excel Discussion (Misc queries) | |||
Excel VBA Target Worksheet change | Excel Discussion (Misc queries) | |||
Using VBA to create a new worksheet, and then target new worksheet | Excel Discussion (Misc queries) | |||
Trapping Events generated by a Worksheet | Excel Programming |