Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
I have an input form that pops up when a user selectes a cell, but I want
them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
How would excel know you have stopped selecting cells?
Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
As the ctrl key needs to be held down to select non-contiguious cells I would
have thought it could detect the ctrl key position So, taking finger off the ctrl key could be the indicator. "Tom Ogilvy" wrote: How would excel know you have stopped selecting cells? Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
That doesn't trigger an event.
-- Regards, Tom Ogilvy "Graham Y" wrote: As the ctrl key needs to be held down to select non-contiguious cells I would have thought it could detect the ctrl key position So, taking finger off the ctrl key could be the indicator. "Tom Ogilvy" wrote: How would excel know you have stopped selecting cells? Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
I was sure I had done this, but maybe it was only when testing and it failed
leaving Events turned off. Can I test for ctrl key down in my event? Then I can control whether to display my form. Thanks "Tom Ogilvy" wrote: That doesn't trigger an event. -- Regards, Tom Ogilvy "Graham Y" wrote: As the ctrl key needs to be held down to select non-contiguious cells I would have thought it could detect the ctrl key position So, taking finger off the ctrl key could be the indicator. "Tom Ogilvy" wrote: How would excel know you have stopped selecting cells? Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
You can test for it, but you just said it would be down.
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error Resume Next 'To check wheteher Control key is pressed If GetAsyncKeyState(17) Then MsgBox "Control key pressed" End If End Sub -- Regards, Tom Ogilvy "Graham Y" wrote: I was sure I had done this, but maybe it was only when testing and it failed leaving Events turned off. Can I test for ctrl key down in my event? Then I can control whether to display my form. Thanks "Tom Ogilvy" wrote: That doesn't trigger an event. -- Regards, Tom Ogilvy "Graham Y" wrote: As the ctrl key needs to be held down to select non-contiguious cells I would have thought it could detect the ctrl key position So, taking finger off the ctrl key could be the indicator. "Tom Ogilvy" wrote: How would excel know you have stopped selecting cells? Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
OK so the event actually fires when I click the mouse in a cell, at which
point ctrl must be down, I had thought the event fired when I let go of the mouse, so it looks like I'll have to add a toolbar or something. Thanks for you help "Tom Ogilvy" wrote: You can test for it, but you just said it would be down. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error Resume Next 'To check wheteher Control key is pressed If GetAsyncKeyState(17) Then MsgBox "Control key pressed" End If End Sub -- Regards, Tom Ogilvy "Graham Y" wrote: I was sure I had done this, but maybe it was only when testing and it failed leaving Events turned off. Can I test for ctrl key down in my event? Then I can control whether to display my form. Thanks "Tom Ogilvy" wrote: That doesn't trigger an event. -- Regards, Tom Ogilvy "Graham Y" wrote: As the ctrl key needs to be held down to select non-contiguious cells I would have thought it could detect the ctrl key position So, taking finger off the ctrl key could be the indicator. "Tom Ogilvy" wrote: How would excel know you have stopped selecting cells? Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
Another thought
If I make the form non modal I can select extra cells, but I'm not sure how to get the info onto my form. Currently I load the dates (determined by which column the selected cells are in) into an array, sort it, and then display on my form, to show these are the dates that will be affected by the form. How can I re-evaluate which cells are selected? "Tom Ogilvy" wrote: How would excel know you have stopped selecting cells? Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
I would guess an update button on the form. When clicked, the code executes
to refresh/revise/update the list. -- Regards, Tom Ogilvy "Graham Y" wrote: Another thought If I make the form non modal I can select extra cells, but I'm not sure how to get the info onto my form. Currently I load the dates (determined by which column the selected cells are in) into an array, sort it, and then display on my form, to show these are the dates that will be affected by the form. How can I re-evaluate which cells are selected? "Tom Ogilvy" wrote: How would excel know you have stopped selecting cells? Events don't fire when you don't do anything. -- Regards, Tom Ogilvy "Graham Y" wrote: I have an input form that pops up when a user selectes a cell, but I want them to be able to use ctrl to pick non-contiguious cells, but as soon as I let go of the mouse button, to select the next cell, the form pops up. I know I've done this before because I have put code in to check the range of columns selected, which I have tested. Any Ideas how I stop the form poping up until I have stopped selecting cells? |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
Tom wrote:
<<Events don't fire when you don't do anything. In Excel 2000, the Worksheet_SelectionChange event fires every time you change anything about the selection. For example, say cell $A$1 is currently selected. As soon as you press the shift key and extend the range to include cell $B$2, the Worksheet_SelectionChange event fires. If you then press the Ctrl key to add another cell (say cell $D$5), the Worksheet_SelectionChange event fires again. It fires again when you press the shift key to extend the 2nd area of the selection. -- Regards, Bill Renaud |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_SelectionChange allow multiple ranges to be selected
Ignore my previous post. I had my newsreader in non-grouped mode
momentarily while checking something else, and didn't see the rest of the thread. -- Regards, Bill Renaud |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple cells or columns are selected instead of selected cell or | Excel Discussion (Misc queries) | |||
Macro to name ranges for selected worksheets | Excel Programming | |||
Ranges:Target in Worksheet_SelectionChange(ByVal Target As Range) | Excel Programming | |||
named ranges - changing ranges with month selected | Excel Programming | |||
Using selected ranges | Excel Programming |