+ Reply to Thread
Results 1 to 4 of 4

how I can have the cursor return to the input field

Hybrid View

  1. #1
    Registered User
    Join Date
    03-01-2007
    Posts
    6

    how I can have the cursor return to the input field

    Hello,

    I have a form where the user enters an account number and information about that acount is retrieved and displayed in other fields on the form.

    The problem is that the user has to click eac time into the field beore they can enter the next account number.

    Tried to use the Set Focus but the cursor still doesn't appear in the field for the user to enter the next account.

    Can someone tell me how I can have the cursor return to the input field so that the user can enter the next account number without having to click in the field using the mouse.. A big thank you.


    the

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Setfocus does work. I have used it lots of time.

    Are you sure you are trying to use it at the correct loctation in your code.

    Posting a copy of wour workbook would help us to give a better answer

    Example of using setfocus

    Private Sub CommandButton1_Click()
       Me.TextBox1.Text = vbNullString
       Me.TextBox2.Text = vbNullString
       Me.TextBox1.SetFocus
    End Sub
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    03-01-2007
    Posts
    1

    Keeping cursor in entry cell

    The simplest way to stay in the same cell after hitting Enter is to go to Tools|Options and select the Edit tab. Uncheck the box next to "Move selection after Enter". You'll save a lot of clicks or arrow key presses!

  4. #4
    Registered User
    Join Date
    03-01-2007
    Posts
    6

    Post Application.OnKey

    Thanks toythinker snd mudraker.


    Another question:

    I want to execute a routine everytime the ENTER key is pressed. I am using the code shown below. The idea is to allow the processing to take place once the enter key is pressed and not allow the user to click on a command "submit" button.

    However, nothing happens when I press the enter key


    Public Sub UserForm_Activate()

    Application.OnKey "{ENTER}", "Submit"
    Application.OnKey "~", "Submit"

    End Sub

    Can anyone assist me with this issue?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1