Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2008, 11:59 PM
Authorized User
 
Join Date: Jun 2008
Location: sydney, nsw, Australia.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mona_upm84
Default Move cursor to specific textbox

Hi all,

How can i make sure the cursor from textbox A go to textbox C, not textbox B? In every textbox of my userform, there is a procedure where textbox will be disabled once data entered, to make sure no alteration.

But after entered current textbox, the cursor jump to other textbox randomly. I got more than 50 textboxes in one form and this will annoy user everytime they want to key in data. I need it to move to the next textbox automatically after user press "Enter" button on keyboard, so that user can enter next data easily, without have to click with mouse.

Any help are most welcome....

Thanks!!

 
Old July 18th, 2008, 07:56 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

The easiest way is to set the TabIndex of the Textboxes in sequence (1, 2,3..).

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old July 29th, 2008, 07:06 PM
Authorized User
 
Join Date: Jun 2008
Location: sydney, nsw, Australia.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mona_upm84
Default

Hi shasur,

thanks for replied. The cursor did not move to the next textbox even when i set those textboxes according to 1,2,3.....

this is because i set those textboxes to be disabled whenever user enter data once, this is for data integrity issue. so i found out another way to make sure the cursor move the next textbox which is by using 'setfocus.'


For example from textbox1 to textbox to:

Private Sub TextBox1_Change()
If Me.TextBox1.Text = "" Then
   Me.TextBox1.Enabled = True
Else
   Me.TextBox1.Enabled = False
   Me.TextBox2.SetFocus
End If
End Sub


With this 'SetFocus', cursor will move to the specified textbox. Hope this helps other friends who faced with this problem as well....

Cheers,
Mona

 
Old September 22nd, 2016, 10:29 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks

This was helpful to me. Thanks.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Move cursor to specific textbox mona_upm84 Excel VBA 0 September 29th, 2008 09:35 PM
Javascript to move cursor frm one textbox to othr lakshmi_annayappa Javascript 1 July 23rd, 2007 05:16 AM
Move image when cursor approaches sanjana Pro Visual Basic 2005 1 July 19th, 2007 04:55 PM
Move cursor to beginning of field in form Odeh Naber Access 3 June 5th, 2007 04:21 PM
how shall I move the cursor? nerssi Javascript 0 September 21st, 2004 09:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.