code to tab to a specific cell

tonylpcs@yahoo.co.uk

Active Member
Joined
Dec 19, 2007
Messages
379
Hi everyone,

can someone please give me a code so i can tab into a specific cell?

when im in cell c5 i want to be able to hit the tab button and go to cell k9,

can i do this?

please help

thanks

Tony
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I am by no means an expert but this may help get you started at least

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$5" Then
Range("K9").Activate
End If
End Sub

right click sheet tab choose view code and paste the code above in the vbe window which appears.
this is a change event so is triggered whenever cell C5 is edited..would work with shift key/ enter key etc as long as C5 is in edit mode.

Hope its a start!
 
Upvote 0
No problems any issues just post back I'm certain someone will help you.

(Everything I learnt I learnt from here)
 
Upvote 0
Or maybe something along these lines :

Place in the worksheet module

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = "$C$5" Then
        Application.OnKey "{TAB}", Me.CodeName & ".HookTabKey"
    Else
        Application.OnKey "{TAB}"
    End If
End Sub
Private Sub Worksheet_Deactivate()
    Application.OnKey "{TAB}"
End Sub

Private Sub HookTabKey()
    Me.Range("K9").Activate
End Sub
 
Upvote 0
If you are really intent on doing this when you hit TAB key then try something like:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.OnKey "{TAB}", "[B][I]Sheet1.[/I][/B]MoveToAddress" 'Change to sheet name
End Sub
Public Sub MoveToAddress()
If ActiveCell.Address = "$C$5" Then
Range("K9").Activate
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top