Disabling "next cell" in a table

V

VBA Neophyte

I have a table divided into protected and unprotected sections. In the
unprotected sections, when the user tabs, a new line is created (as though
it were the end of the table). I want to disable the "next cell" function in
these cases, or otherwise prevent the creation of a new row, or force
navigation to the next form field/section. Any suggestions?

Thanks.
 
H

Helmut Weber

Hi Neophyte,

something along these lines:

Sub NextCell()
Dim rTbl As Range
Set rTbl = Selection.Tables(1).Range
If Selection.Cells(1).Range.IsEqual( _
rTbl.Cells(rTbl.Cells.Count).Range) Then
MsgBox "lastcell"
Else
Selection.Cells(1).Next.Select
Selection.Collapse
End If
End Sub

HTH

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

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