ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how can I make tabs work only in the colums being used? (https://www.excelbanter.com/excel-discussion-misc-queries/112246-how-can-i-make-tabs-work-only-colums-being-used.html)

lecielbleu

how can I make tabs work only in the colums being used?
 
Tabs move from colum to colum to the right. But, it keeps going to right
colums.
How can I make the tabs move right only until the last colum that I am
using, then move to the next row?

Thanks for your answer in advance.

Gord Dibben

how can I make tabs work only in the colums being used?
 
Start in A1

Tab to B1,C1,D1,E1,F1 entering data as you go.

When you leave F1 hit the ENTER ley to return to column A and one cell
down........A2

You will always go back to the column you started from.

i.e. start in C1.........go back to C2

OR unlock columns A:F and protect the sheet.

Tab key will go across to F then back to A one row down.

I prefer the first method because protecting a sheet can cause other problems.


Gord Dibben MS Excel MVP


On Fri, 29 Sep 2006 16:17:02 -0700, lecielbleu
wrote:

Tabs move from colum to colum to the right. But, it keeps going to right
colums.
How can I make the tabs move right only until the last colum that I am
using, then move to the next row?

Thanks for your answer in advance.



Ken Johnson

how can I make tabs work only in the colums being used?
 
If it really really really has to be the Tab key then select those
columns or use a Worksheet_SelectionChange event procedure such as...

Option Explicit
Public rngPreviousCell As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim lLastColumn As Long
lLastColumn = Cells(1, Range("1:1").Columns.Count).End(xlToLeft).Column
On Error Resume Next
If rngPreviousCell.Column < lLastColumn + 1 Then
On Error GoTo 0
If ActiveCell.Column = lLastColumn + 1 Then
Application.EnableEvents = False
ActiveCell.Offset(1, -lLastColumn).Select
End If
Application.EnableEvents = True
End If
Set rngPreviousCell = ActiveCell
End Sub

which keeps the Tabbed-to-cell within the columns from column A up to
the last used column. To get out of that range you will have to select
a cell in the column after the next available column, since the code
relies on the selection of a cell in the next available column to take
the selection to the next row down.

Ken Johnson



All times are GMT +1. The time now is 04:06 PM.

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