I have a userform in which the user makes an entry into a text box. A countdown of remaining characters allowed is displayed as the entry is made. When finished a commandbutton is clicked launching the following code:
Private Sub cbLeadEnter_Click() ActiveCell.Offset(0, 0).Value = Me.tbLead.Value 'Textbox entry value is loaded to worksheet ActiveCell.Offset(0, 1).Select 'The next cell to the right is selected tbLead.Value = "" 'The textbox value is reset to blank Unload ufLead 'The userform is unloaded AppActivate ("Microsoft Excel") 'Excel should take focus - but it doesn't ActiveCell.Activate 'I tried this just to see if it would cause Excel to take focus but it didn't work either End Sub
What should happens is the userform unloads and the user can immediately make an entry into an activecell. The problem is that the user must click on the cell or the Application Title Bar to activate Excel to make the entry. It is annoying and I can't figure out how to correct it.
Okay, I found the problem. I changed the userform ShowModal property to False. Now when the userform closes the worksheet gets focus. I don't understand why, but it worked.