empty text box in a userform

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
784
Office Version
  1. 365
Platform
  1. Windows
Hi

I have a UserForm with the following code
VBA Code:
Private Sub CommandButton1_Click()
    With TextBox1 
        ActiveSheet.Range("af2").Value = .Text
     End With
    With TextBox3 
        ActiveSheet.Range("ag2").Value = .Text
    With TextBox10  
        ActiveSheet.Range("ah2").Value = .Text
     End With
 Me.Hide
End With
find
Unload Me
End Sub
What the fine macro does is an advance search looking for the input word from one of the text boxes. (only one text box will have input)
If the input can’t be found, a message box comes up with “no match try again” and any input in AF2:AH2 gets deleted
Then the userform comes up again.

Is there a way to have the textbox without the previous input so the user doesn’t have to delete it.



mike
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You can write, e.g. TextBox1.Text = "" at the appropriate point in your code to set the text in Textbox1 to the empty string. Repeat the same for the other text boxes.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top