Consulting

Results 1 to 10 of 10

Thread: form - cursor position - Excel 2007

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Location
    Los Angeles
    Posts
    9
    Location

    form - cursor position - Excel 2007

    1. I have created a data entry form with 8 fields. When the form comes up the cursor points to the second field, rather than the first one. I must have done something wrong when I created the form using the tool box, but I cannot see what the cause is and how to make it point to the first field.

    2. The form does not come up when the spreadsheet is displayed. I have to get it via view, macros, view macros, edit, forms, view, object ... which is so convoluted it defeats the purpose of the form.

    anybody have a clue what I need to do?

    thank you.

    (I have to leave now, will be back later this afternoon)

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    There is a property called TabIndex associated with each control. Set the first cell to visit to TabIndex 1, second to 2, and so on.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor tpoynton's Avatar
    Joined
    Feb 2005
    Location
    Clinton, MA
    Posts
    399
    Location
    I find using Tab Order (under View in VBE) very helpful!

    Regarding #2, do you want the form to always be visible when the workbook is opened?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by tpoynton
    I find using Tab Order (under View in VBE) very helpful!
    I find it simpler to select the controls in my required tab order, and then set the TabIndex property to 1. VBA increments each of the successive controls automatically.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Nov 2007
    Location
    Los Angeles
    Posts
    9
    Location
    Thank you xld.

    I found the TabIndex, it is set to one for the first field, but the cursor is not at the first field. I think I cannot set it in the subroutine for the first field, at that time it is too late.

    Thank you tpoynton.

    I would like the form to come up when I open the Excel file or have an easy key sequence to bring the form to the foreground.

    The Tab Order under View is greyed out, I cannot use it.

    I think I have to buy a book before I ask any more questions. I have too many problems with really basic stuff. Like all the properties of a field showed on the lower left side of the VBE window, now they are not there any more and I don't know how to get them back. I try things and then I forget what I did and cannot repeat it!

    I got a macro to work. It copies data from one sheet to another, reformats and summarizes. I got most of the code from the macro recorder. I thought data entry would be easier by using a form because I can edit the data and create error messages while the data is entered. I got it to work, too. When I enter data into a field it shows up on the form and in the Sheet destination field as it is typed one character at a time. Now it is just minor detail like the cursor that does not want to do what I think it should do.

    Thank you for your help.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by otto
    Thank you xld.

    I found the TabIndex, it is set to one for the first field, but the cursor is not at the first field. I think I cannot set it in the subroutine for the first field, at that time it is too late.
    Sorry I should have said set it to 0, the TabIndex starts at 0.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by otto
    Like all the properties of a field showed on the lower left side of the VBE window, now they are not there any more and I don't know how to get them back.
    F4 in the VBIDE.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    VBAX Regular
    Joined
    Nov 2007
    Location
    Los Angeles
    Posts
    9
    Location

    thank you xld

    TabIndex = 0 solved my erratic cursor. the F4 brought back the properties of the fields I was looking at. thanks.

  9. #9
    VBAX Mentor tpoynton's Avatar
    Joined
    Feb 2005
    Location
    Clinton, MA
    Posts
    399
    Location
    I think that putting 'youruserformname.show' in the workbook open event of ThisWorkbook will open the userform when you open the excel file. It will probably be best to have a button or key sequence to open it, because if the userform is closed, the file will need to be closed and opened to reopen the userform.

    Lucas has a tutorial here explaining how to find ThisWorkbook.

    You know, assigning a key sequence to a macro should be relatively straightforward, but I do not know how to do it at present! It might be done through the macro menu.

    Regarding a book, I find most things I need via Google, VBA help, an older Excel 2000 book, searching the forum here, and posting questions here - in that order!

  10. #10
    VBAX Regular
    Joined
    Nov 2007
    Location
    Los Angeles
    Posts
    9
    Location

    solved

    thank you tpoynton.

    I have no problem running a macro, a form seems to be slightly different, but I will manage.

    let's consider this question answered.

Posting Permissions

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