ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing the behavior of the "tab" button (https://www.excelbanter.com/excel-programming/292407-changing-behavior-tab-button.html)

Sterling[_2_]

Changing the behavior of the "tab" button
 
I have a worksheet setup where there are 4 data entry columns. The
other columns are locked and cannot be selected. This application is
intended for live data entry and speed in entry is extremely
important.

One of the data entry columns is a "Comment" column that will rarely
be selected. As the user enters data, I would like for the active
cell to go A1, B1, C1, A2, B2, C2, A3... each time they press the tab
key. I only want them to go to column D (comment column) if they
actually move the cursor to that column and select a cell.

As it is right now of course, the user has to press tab twice after
entering column C data in order to get back to column A. I would like
to avoid that 2nd tab entry if it is possible.

Thanks.
Sterling

Tom Ogilvy

Changing the behavior of the "tab" button
 
Right click on the sheet tab and select view code.

Place this in the resulting module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Column < 4 Then
Application.EnableEvents = False
Columns("A:C").Select
Target.Activate
End If
If Target.Column 4 Then
Application.EnableEvents = False
Cells(Target.Row + 1, 1).Select
End If
ErrHandler:
Application.EnableEvents = True
End Sub


This should give you some ideas - you can adjust to match your desired
behavior.

--
Regards,
Tom Ogilvy

"Sterling" wrote in message
om...
I have a worksheet setup where there are 4 data entry columns. The
other columns are locked and cannot be selected. This application is
intended for live data entry and speed in entry is extremely
important.

One of the data entry columns is a "Comment" column that will rarely
be selected. As the user enters data, I would like for the active
cell to go A1, B1, C1, A2, B2, C2, A3... each time they press the tab
key. I only want them to go to column D (comment column) if they
actually move the cursor to that column and select a cell.

As it is right now of course, the user has to press tab twice after
entering column C data in order to get back to column A. I would like
to avoid that 2nd tab entry if it is possible.

Thanks.
Sterling





All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com