LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Bug in Excel 2000? (CurrentRegion property triggers events)

Greetings,
In order to get a better understanding of the CurrentRegion property
I wrote the following code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox Target.CurrentRegion.Address
End Sub

Now if A1 (say) is part of a block of non-blank cells and I select A1
then *three* times I end up having to dismiss the message box.
Apparantly, the CurrentRegion property, when it returns more than 1
cell, triggers two selection change events. At least it doesn't hang up
in an infinite loop.

To test this hypothesis I wrote

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox Target.Address
End Sub

Sub test()
Dim R As Range
Set R = Range("A1").CurrentRegion
End Sub

The act of running test() triggers two selection changes. In my
experiment, A1:B12 is a range of contiguous non-blank cells. I start by
selecting (say) D10 and then run test(). Twice a message box with
$A$1:$B$12 appears, after which D10 is still selected. Wierd. I would
find the bug more understandable if the second message box was $D$10.
Application.EnableEvents provides a work-around.

Has anyone else encountered this bug? Are there any other phantom
events I should be aware of?

-John Coleman

 
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
ActiveCell.CurrentRegion property Microsoft Forum Excel Programming 4 January 11th 05 02:43 PM
Using XP Events with Excel 2000 Users Tod Excel Programming 1 April 5th 04 08:09 PM
How-To - Forwarding Excel 2000 events to .Net application Joel Foner Excel Programming 0 January 28th 04 11:34 PM
Triggers events Bourbon[_19_] Excel Programming 2 January 23rd 04 08:02 PM
.CurrentRegion in Excel functions Tim Lund Excel Programming 1 December 18th 03 03:47 PM


All times are GMT +1. The time now is 05:10 PM.

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"