byronwall / bUTL

Excel add-in with helpers for charting, formatting, and general pain points
http://byroni.us/bUTL
MIT License
16 stars 3 forks source link

Improve Selection shifter/offsetter #24

Closed byronwall closed 9 years ago

byronwall commented 9 years ago

There is a whole interface on the Ribbon for shifting the Selection a given number of rows/columns. This would probably be much better off with a quick keyboard shortcut that shifts the Selection. The interface as it sits is not that useful. I have actually never used it.

image

Decent shortcuts would be CTRL+ALT+{ARROW} to move the Selection around. This has the downside of being the same shortcut used to flip the monitor around. Not sure if that takes precendence; I disable the monitor flipping stuff. Another option would be CTRL+ALT+SHIFT+{ARROW} which is not commonly used (I don't think) but involves a lot of keys at once.

Relevant code:

Sub SetHotKeys()
    'this would go into an onload for the Ribbon.

    Application.OnKey "^%{RIGHT}", "OffsetRight"

End Sub

Sub OffsetRight()

    Selection.Offset(, 1).Select

End Sub
RaymondWise commented 9 years ago

For me, it shifts the selection, but not the contents of the cells that were selected. Is that how it was intended?

byronwall commented 9 years ago

Yea. It is supposed to just shift the selection. It was supposed to help in a case where you some funky selection and just wanted to go over one column to delete the cells next door (or something similar).

Although moving the range might be a more useful thing. Maybe CTRL+ALT moves selection and CTRL+ALT+SHIFT moves the actual contents. It gets into the same discussion about how to update formulas when doing that, but it might be useful in a number of cases that are not problematic. Any thoughts on that?

byronwall commented 9 years ago

Like I said, I have never actually used this one because it is not that convenient. Maybe it is not a useful feature regardless of how accessible it is. For some reason I like the idea of moving the Selection though. It just seems like something that should be possible.

I am looking at the Ribbon now and thinking of how to organize things better to make room for all the features that don't have space in the Ribbon yet.

RaymondWise commented 9 years ago

Well, currently it's impossible to move a selection to anywhere else without making a new selection - so the feature does have some merit in creating functionality.

byronwall commented 9 years ago

Alright, I'll wire this one up for the CTRL+ALT shortcuts for now to move the Selection. I'll test that with the monitor shortcuts to make sure this doesn't create a headache for people.

If that works nicely, we can take a look at adding in the ability to move ranges around with the keyboard as well.

I will also remove the textboxes and such from the Ribbon. This will be keyboard only if it exists.

byronwall commented 9 years ago

Got this bit added in. Cleans up the Ribbon nicely to remove that chunk of boxes.

I confirmed at work that this will not play nice with the Intel monitor shortcuts CTRL+ALT+{ARROW}. I personally disable those because I never need to rotate the monitor around. If this is a conflict, let me know.

RaymondWise commented 9 years ago

Those are easy enough to disable, but it's too bad that can't be built in when installing the add-in (or give an option to the user on what they want to do).

byronwall commented 9 years ago

The add-in could probably hook into some Win32 API and override or maybe disable the monitor shortcuts. Not sure how easy it is to revert those though when the add-in is closed. I also start to get a little nervous when the add-in is using those APIs and going into unexpected places. The user might wonder what the add-in is doing with those API calls.

byronwall commented 9 years ago

I'll call this implemented for now. If the keyboard shortcut becomes an issue, we can open a new issue to address it. I actually used this the other day to move a selection over.