Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to get address of source of copy (range with marquee a.k.a. "marching ants")
In the Worksheet_SelectionChange event, is there a way to determine
the range of cells currently highlighted with the marquee, given that CutCopyMode is true? The reason I'd like to know is that I am changing the Enable state of a command button depending on the Target range (i.e. where the user is placing the cursor); if in a certain range, the button is to be enabled, otherwise it is to be disabled. The problem is that setting the Enable property on the button clears the CutCopyMode state. This breaks copy-paste functionality. Since I already have a selection change event handler (for other reasons), I intended to work around this issue by noting the source range, changing the button state as required, reselecting the source range, and then reactivating the Target. So instead of just: btnAddRow.Enabled = enb ' set button state as req'd I planned to instead do: If btnAddRow.Enabled < enb Then ' if change req'd If Application.CutCopyMode < 0 Then ' if marquee is up Set r = Application.CutCopySourceRange ' get marquee range btnAddRow.Enabled = enb ' set enable state r.SetAsCopySource ' restore marquee Target.Activate ' restore ActiveCell Else btnAddRow.Enabled = enb ' just set enable property as required End If End If I would entertain alternatives. I thought about tracking the current selection, but I'm not sure I can reliably determine the actual range with the marquee that way. Thanks tbone |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Marching ants" around copied cell | New Users to Excel | |||
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),Range ... ? | Excel Worksheet Functions | |||
How to setup "marching ants" border Excel cell? OK in MS Word. | Excel Discussion (Misc queries) | |||
how to get marching ants in Excel programmatically | Excel Programming | |||
Marching ants | Excel Programming |