Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
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 January 20th, 2005, 11:50 AM
Authorized User
 
Join Date: Sep 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default position cursor at certain field on user form

Hi -

I have designed a user form to accept data entry from users. Several checks are incorporated to ensure the data entered are corrected and correlated with data entered for other fields on the same user form.

However, I don't know how to position the cursor to the field where I want the user to correct the data? For instance. The user entered 1 study (TB_Num_Study = 1) only. But, he went to study 2 to enter the start date. I want to bring the cursor to number of studies field to prompt user for correction, but don't how?

Thanks.
Kathy
 
Old January 21st, 2005, 06:51 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Kathy,

I'm not totally sure what your asking because you have a very specific example you are working on, but I think this will probably go some way to helping you.

paste this in the code behind your userform.

Sub TextBox1_Change()
    Select Case TextBox1.Value
        Case 1
            TextBox3.SetFocus
        Case 2
            TextBox4.SetFocus
        Case Else
            MsgBox ("Not a valid selection, please try again")
            TextBox1.SetFocus
    End Select
End Sub

cheers

Matthew






Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard cursor position rahesh VB.NET 1 May 8th, 2008 01:27 PM
Cursor.Position iremtoksoz C# 3 January 2nd, 2008 11:41 AM
Move cursor to beginning of field in form Odeh Naber Access 3 June 5th, 2007 04:21 PM
How to set cursor position in a textbox? zayasv VB.NET 2 April 29th, 2006 07:09 AM
aspx cursor position nutrino ASP.NET 1.0 and 1.1 Basics 6 December 29th, 2005 10:51 AM





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