Tabbing through unlocked cells
I've create a form and I want to be able to tab through the the unlock cells
in a certain order. Now when I hit the tab key it tabs from left to right by rows. I want to set the order of the "tabbing" with maybe a macro. Is this possible?-- Garyw |
Tabbing through unlocked cells
See http://www.xldynamic.com/source/xld.xlFAQ0008.html
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Garyw" wrote in message ... I've create a form and I want to be able to tab through the the unlock cells in a certain order. Now when I hit the tab key it tabs from left to right by rows. I want to set the order of the "tabbing" with maybe a macro. Is this possible?-- Garyw |
Tabbing through unlocked cells
In addition to what you find on Bob's site, here is event code from Anne Troy.
Private Sub Worksheet_Change(ByVal Target As Range) 'Anne Troy's taborder event code Dim aTabOrd As Variant Dim i As Long 'Set the tab order of input cells aTabOrd = Array("A5", "B5", "C5", "A10", "B10", "C10") 'Loop through the array of cell address For i = LBound(aTabOrd) To UBound(aTabOrd) 'If the cell that's changed is in the array If aTabOrd(i) = Target.Address(0, 0) Then 'If the cell that's changed is the last in the array If i = UBound(aTabOrd) Then 'Select first cell in the array Me.Range(aTabOrd(LBound(aTabOrd))).Select Else 'Select next cell in the array Me.Range(aTabOrd(i + 1)).Select End If End If Next i End Sub This is sheet event code. Right-click on the sheet tab and "View Code". Copy/paste the above into that sheet module. Gord Dibben MS Excel MVP On Fri, 30 Mar 2007 08:18:02 -0700, Garyw wrote: I've create a form and I want to be able to tab through the the unlock cells in a certain order. Now when I hit the tab key it tabs from left to right by rows. I want to set the order of the "tabbing" with maybe a macro. Is this possible?-- Garyw |
Tabbing through unlocked cells
I can't get Anne's code to work. I've checked it several times.
-- Garyw "Gord Dibben" wrote: In addition to what you find on Bob's site, here is event code from Anne Troy. Private Sub Worksheet_Change(ByVal Target As Range) 'Anne Troy's taborder event code Dim aTabOrd As Variant Dim i As Long 'Set the tab order of input cells aTabOrd = Array("A5", "B5", "C5", "A10", "B10", "C10") 'Loop through the array of cell address For i = LBound(aTabOrd) To UBound(aTabOrd) 'If the cell that's changed is in the array If aTabOrd(i) = Target.Address(0, 0) Then 'If the cell that's changed is the last in the array If i = UBound(aTabOrd) Then 'Select first cell in the array Me.Range(aTabOrd(LBound(aTabOrd))).Select Else 'Select next cell in the array Me.Range(aTabOrd(i + 1)).Select End If End If Next i End Sub This is sheet event code. Right-click on the sheet tab and "View Code". Copy/paste the above into that sheet module. Gord Dibben MS Excel MVP On Fri, 30 Mar 2007 08:18:02 -0700, Garyw wrote: I've create a form and I want to be able to tab through the the unlock cells in a certain order. Now when I hit the tab key it tabs from left to right by rows. I want to set the order of the "tabbing" with maybe a macro. Is this possible?-- Garyw |
Tabbing through unlocked cells
Anne's code will work if you make changes to a cell in that array of addresses.
It work if you're just by tabbing. (F2 and hitting enter will be enough to fire the change event.) Garyw wrote: I can't get Anne's code to work. I've checked it several times. -- Garyw "Gord Dibben" wrote: In addition to what you find on Bob's site, here is event code from Anne Troy. Private Sub Worksheet_Change(ByVal Target As Range) 'Anne Troy's taborder event code Dim aTabOrd As Variant Dim i As Long 'Set the tab order of input cells aTabOrd = Array("A5", "B5", "C5", "A10", "B10", "C10") 'Loop through the array of cell address For i = LBound(aTabOrd) To UBound(aTabOrd) 'If the cell that's changed is in the array If aTabOrd(i) = Target.Address(0, 0) Then 'If the cell that's changed is the last in the array If i = UBound(aTabOrd) Then 'Select first cell in the array Me.Range(aTabOrd(LBound(aTabOrd))).Select Else 'Select next cell in the array Me.Range(aTabOrd(i + 1)).Select End If End If Next i End Sub This is sheet event code. Right-click on the sheet tab and "View Code". Copy/paste the above into that sheet module. Gord Dibben MS Excel MVP On Fri, 30 Mar 2007 08:18:02 -0700, Garyw wrote: I've create a form and I want to be able to tab through the the unlock cells in a certain order. Now when I hit the tab key it tabs from left to right by rows. I want to set the order of the "tabbing" with maybe a macro. Is this possible?-- Garyw -- Dave Peterson |
Tabbing through unlocked cells
Typo probably
It "won't" work if you're just tabbing. Gord On Fri, 30 Mar 2007 14:32:22 -0500, Dave Peterson wrote: It work if you're just by tabbing. |
Tabbing through unlocked cells
The code does run if I press F2 and Enter.
I would prefer a one key tab but this will work fine. Thanks so much for your help. -- Garyw "Gord Dibben" wrote: Typo probably It "won't" work if you're just tabbing. Gord On Fri, 30 Mar 2007 14:32:22 -0500, Dave Peterson wrote: It work if you're just by tabbing. |
All times are GMT +1. The time now is 11:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com