Hi... I am fairly new to VBA programming in EXCEL. So my apologies in advance. I have a USERFORM with several CHECKBOXs and one TEXTBOX. When the user clicks a checkbox the textbox appears next to it for the user to enter dollar amounts.

I am trying to use the ENTER KEY from the TEXTBOX to set the TEXTBOX.VISABLE to FALSE. But, I cannot get it working. I have tried to use KeyPress, KeyDown, KeyUp and Exit to no avail. When I check for the KeyAscii or KeyCode it is blank. I anly see the numbers that were entered in the TEXTBOX.

Do you know how I can check for the enter key from within the TEXTBOX? Thank you in advance.

Yes you can check just make sure that key preview property of that form will need to be enabled. if it is enabled then you will easily gate the value of the textboxes....

Private Sub TextBox1_[B]KeyPress[/B](ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        [B]If e.KeyChar = Chr(13) Then TextBox1.Visible = False[/B]
    End Sub

Thank you so much for your help. Your suggestion was very helpful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.