Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Controlling Entry Order on Unprotected Cells.
by Allen Wyatt
(last updated August 30, 2014)
Rob has a number of worksheets that are used to score assessments. The first worksheet has cells for name, date, etc., then several columns to enter the multiple-choice responses. The sheet is protected, so only input cells can be changed. When the user finishes the last cell in a column, the focus will jump to the next unprotected cell, which may be the first cell in the next column, or it might be the "date" cell. Rob wonders how he can control the focus so that when the value is entered into the last (bottom) cell in a column, it will then move to a cell that he specifies.
There is no built-in way to do this in Excel, as the program determines its own order of choosing which cell is next selected. You can modify which cell is selected next when you press Enter in a worksheet, but you cannot modify what happens when you press Tab in a protected worksheet. By default cells are selected left to right and then top to bottom in the worksheet.
If you want to modify what happens when the Tab key is pressed, then you'll need to resort to using a macro to control the selection order. The following macro is an example; it moves to cell D5 when leaving cell C10 and to E5 when leaving cell D10:
Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False If Target.Address = "$C$10" Then Range("D5").Select If Target.Address = "$D$10" Then Range("E5").Select Application.EnableEvents = True End Sub
The problem with using a VBA solution like this is that it can make your spreadsheet—particularly if it is a large one—a bit more sluggish. By their nature, macros also mean that the Undo feature is disabled.
If your tab order needs are more complex, then you may be interested in the code discussed at this web page:
As you can tell, the code can get rather complex at times. Of course, such an approach, since it stipulates all cell-to-cell movement, makes it more difficult to make changes to the design of the worksheet itself.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10314) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Controlling Entry Order on Unprotected Cells.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
You've protected and saved your worksheet with explicit instructions that you be allowed to insert and delete rows. But when ...Discover More
It is not unusual, in a corporate world, to be handed a worksheet whose source you don't know. If that worksheet is locked ...Discover More
If you receive a protected worksheet that you want to edit, how do you proceed if you try to unprotect the worksheet and ...Discover More