Sub Add_Move_Selection_Keyboard_Shortcuts() It can be put in the Workbook_Open event in the Thisworkbook module of your Personal Macro Workbook. This macro needs to be run once every time you open Excel. We use a combination of Alt, Shift, and directional arrow keys to call the shortcuts. The following macro creates the keyboard shortcuts that start with the Alt key. However, we can also create shortcuts to start with a different key by using the Application.OnKey method. Typically the macro shortcuts start with Ctrl or Ctrl+Shift, and can be assigned in the Macro Options window. We can also assign keyboard shortcuts to the macros.
Up and down arrows not working in excel how to#
Checkout the 3rd video in the series on the Personal Macro Workbook for step-by-step instructions on how to create the buttons. We can assign the macros to custom macros buttons on the Ribbon. There are a few options for calling/running the macros.
On Error Resume Next is used to bypass any errors that are raised when the first/last row/column in the sheet is selected, and the user presses the shortcut to select a row outside the sheet. 'Moves selection up one row On Error Resume Next 'Moves selection down one row On Error Resume Next 'Moves selection one column to the left On Error Resume Next 'Moves selection one column to the right On Error Resume Next Checkout my video series on How to Create a Personal Macro Workbook. Here are the macros that you can copy/paste to your Personal Macro Workbook.
Up and down arrows not working in excel code#
Move-Selection-Macros.zip Download Video: How to Add Code to Your Personal Macro Workbook You can download the file that contains the macros here. In this case we only want to move one row or column, so we will set the RowOffset or ColumnOffset parameter values accordingly. We can use the RowOffset and ColumnOffset parameters to tell Offset how many rows or columns to move. The Range.Offset property allows us to reference the range to above, below, left, or right of the current selected range (Selection). This technique uses a set of four very simple macros. That included using an Excel Table or a macro. In a previous post & video I explained 2 ways to select rows/columns with blanks. This is very useful when you want to select an adjacent row or column that contains blank cells. So, in this post I share a way to accomplish this same task with a single keyboard shortcut or button press. That only works if one row or column is selected, and is a lot of keystrokes. For example, we can move the selection one column to the right using the following shortcut sequence: Shift+Right Arrow, Tab, Shift+Right Arrow
There are other ways to do this natively in Excel using a combination of shortcuts. Have you ever wanted to quickly select a row or column next to the current selection? The following screencast shows an example. This technique is great for selecting rows or columns that contain blank cells. Bottom line: Learn how to create custom shortcuts to move the selection to an adjacent range.