excel - Clearing textbox upon click in VBA -


I'm relatively new to VBA, and working on a small database for my employer I create a text box I am trying to click on which removes the content that I have put in it. For example, I have a text box that is called "first" to put on the first name of a member. When they click it, I want my text to disappear so that they can enter the ones they want. (The case of executing it only once is easily resolved with a statement). I have taken a look at the following question, but neither have responded to me;

There was nothing in the following code

  private sub text box 1_golf focus () TextBox1.Text = "" End Sub   

and the following code gives me an "expected, end of statement" compilation error on 'handles';

  personal subtxtNewNameHere_GotFocus () handles txtNewNameHere.GotFocus txtNewNameHere.Text = "" end sub   

Not sure why among them it is not working for me But, as I said, relatively new to any of this, any help greatly appreciated.

This will clear the text box on focus if it is not already focused:

  Private sub text box 1_enter (TextBox1.Value = "" End sub   

This will not clear the text box every time it is clicked. Does this help?

Comments