![]() |
Tab from one Text Box to a different Text Box
I am creating a user interface using text boxes (activex controls) and
I want to be able and tab from one text box to the next. The text boxes are located on the sheet itself not in a form. Does anyone know if this can be done. Thanks. |
Tab from one Text Box to a different Text Box
Here is code Rob Bovey previously posted related to tabbing through controls
on a worksheet: From: Rob Bovey ) Subject: Worksheet Controls Newsgroups: microsoft.public.excel.programming Date: 2000/07/22 Hi Fabio, <<1 - Is there a way to establish the tab order of worksheet controls, or even have the Tab or Enter key select them continuously ( as they do in cells)? There's no automatic way of doing it that I know. You have to do it yourself using the KeyDown event for each of the controls on your worksheet. If the KeyCode argument of the KeyDown event for a given control tells you that TAB or ENTER has been pressed, you explicitly activate the control that you want to be next in line. Here's a simple example: Private Sub TextBox2_KeyDown( _ ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) ''' Check if the TAB or ENTER key was pressed. If KeyCode = vbKeyTab Or KeyCode = vbKeyReturn Then ''' If this is Excel 97 you must select a cell ''' before attempting to activate another control. If Val(Application.Version) < 9 Then Me.Range("A1").Select End If ''' Move the focus appropriately. If CBool(Shift And 1) Then ''' The user was holding down the SHIFT key ''' move back to the previous control. TextBox1.Activate Else ''' Move to the next control. TextBox3.Activate End If End If End Sub ----------------------- -- Regards, Tom Ogilvy German wrote in message om... I am creating a user interface using text boxes (activex controls) and I want to be able and tab from one text box to the next. The text boxes are located on the sheet itself not in a form. Does anyone know if this can be done. Thanks. |
All times are GMT +1. The time now is 06:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com