Query

I

Imran

Dear
I want to solve the problem that i m facing in MS-Excel
Q.
For example, I am currently in A1, i want to go to E1 by pressing single
Tab. At the same time, i should be able to edit the cell in columns B,C and D.
 
J

JE McGimpsey

Imran said:
Dear
I want to solve the problem that i m facing in MS-Excel
Q.
For example, I am currently in A1, i want to go to E1 by pressing single
Tab. At the same time, i should be able to edit the cell in columns B,C and D.

One way:

Put this in your ThisWorkbook Code Module (CTRL-click the workbook
header and choose View Code - delete any automatically inserted code):

Private Sub Workbook_Open()
Application.OnKey "{TAB}", "AtoE"
End Sub

Put this in a regular code module (while in the Visual Basic Editor,
choose Insert/Module):

Public Sub AtoE()
If TypeOf Selection Is Range Then
With ActiveCell
If .Column = 1 Then
.Offset(0, 4).Activate
Else
If .Column <> .Parent.Columns.Count Then _
.Offset(0, 1).Activate
End If
End With
End If
End Sub

Note: This will not act like the regular tab key in a multiple cell
selection, where upon reaching the right edge of the selection, tab
moves to the left side of the selection and down a row. The code isn't
hard to write, but I'll leave it as an exercise.

Note2: In order to activate the OnKey setting, close and reopen the
workbook.
 
J

JE McGimpsey

JE McGimpsey said:
Note: This will not act like the regular tab key in a multiple cell
selection, where upon reaching the right edge of the selection, tab
moves to the left side of the selection and down a row. The code isn't
hard to write, but I'll leave it as an exercise.

Note also that opening this workbook will alter the tab key behavior for
all workbooks during that session, unless overwritten by another OnKey
command. Again, the code to prevent that isn't hard to write.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top