View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default 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