xltrader100
08-03-2008, 07:40 AM
I have a table that's 8 cols wide and any number of rows. One of the things that will happen frequently is that the user will select some number of contiguous rows and drag them to a new position in the table, and I'm trying to make that easier for them because a long drag can be kind of perilous.
If the user was doing it manually, he'd insert the same number of blank rows as he's going to drag, then do the drag and drop, and then repair the gap that was left. I have no problem in simulating those actions in VBA but where I'm stuck is in detecting what the user's intentions are.
Ideally, I'd like to have him select his block of rows, then go and click on another cell up or down the table to indicate where they should go, and then click a control that says "put 'em there". Of course as soon as he clicks on another cell the original selection goes away. I can't use a right-click because that's used for something else. If he Ctrl-clicks then the clicked cell gets selected and the original selection stays shaded but I don't know how to reference the shaded cells after the click.
Another way that looks promising is to trap all mouse-down events on any table cell (which happens before the click event) and then set a reference to any selected rows before they get deselected by the click event. And then await developments. If his intention turns out to be moving the rows, then I'm good to go, or if the eventual click led to some other action then so be it. Looking for ideas.
If the user was doing it manually, he'd insert the same number of blank rows as he's going to drag, then do the drag and drop, and then repair the gap that was left. I have no problem in simulating those actions in VBA but where I'm stuck is in detecting what the user's intentions are.
Ideally, I'd like to have him select his block of rows, then go and click on another cell up or down the table to indicate where they should go, and then click a control that says "put 'em there". Of course as soon as he clicks on another cell the original selection goes away. I can't use a right-click because that's used for something else. If he Ctrl-clicks then the clicked cell gets selected and the original selection stays shaded but I don't know how to reference the shaded cells after the click.
Another way that looks promising is to trap all mouse-down events on any table cell (which happens before the click event) and then set a reference to any selected rows before they get deselected by the click event. And then await developments. If his intention turns out to be moving the rows, then I'm good to go, or if the eventual click led to some other action then so be it. Looking for ideas.