• Select doesn’t allow me to type in cell (Excel 2003 & VBA)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Select doesn’t allow me to type in cell (Excel 2003 & VBA)

    Author
    Topic
    #436422

    Hi All,

    I have attached a workbook with a macro that basically checks to see if A4 is/has a study number in it, if it doesn’t, A4 is selected and the user can type in it.
    If the study number is okay, the user is prompted for a password and if the password is okay, then cell G10 is selected so the user can type in it. However, the user canNOT type in it unless (s)he actually clicks cell G10 and then they can type. This is the problem.

    (FYI … this is the first time I have used a form for a password and I am using someone else’s code I found … )

    To test this (if you want):
    You can enter Nothing in A4 and you will get a message and the focus goes back to A4 so the user can type.
    Then, you can enter 77777 in A4 and click the button “Get Milestones”. The user is prompted for a password … please use: cat.
    Some rows are displayed and the focus is placed on cell G10 … unfortunately the user cannot simply start typing.

    Any help would be appreciated …

    Thanks,
    –cat

    Viewing 1 reply thread
    Author
    Replies
    • #1034547

      As far as I can tell, Excel doesn’t always get the focus back, because you only hide the form instead of unloading it. Try the following in GetTypicalMilestones:

      ‘Ask for their password
      frmPassword.Show 1
      mypassword = frmPassword.txtPassword
      Unload frmPassword

      • #1034553

        Thank you, Hans. That worked! I didn’t even know that I was hiding something!

    • #1034548

      The display alerts line must be commented out. If you run the macro, press debug when the macro fails. You will see it selects the Application.displayalerts=true. This line must be commented out by putting a ( ‘ ) single apostrophe infront of the line. (You can also delete it if you want)

      The macro runs fine atfer doing this!

      • #1034552

        I don’t think DisplayAlerts has anything to do with it, and commenting it out doesn’t work for me (or rather, it works the first time, but not if you click the button a second time)

        • #1034554

          I notice now yes….after your message to me, I went into the file again and it debugged on another line!
          Sorry….I almost thought I have a solution there!!

    Viewing 1 reply thread
    Reply To: Select doesn’t allow me to type in cell (Excel 2003 & VBA)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: