Remove Value from TextBox if another Textbox is selected

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,832
Office Version
  1. 2007
Platform
  1. Windows
Hi,
Im not sure what the procedure is called but,

On my userform i Have 2 Textboxes.
TextBox8 & TextBox11

If i click in TextBox8 & type a value but then click in TextBox11 im looking to have that typed value removed.
Cant think of procedure name to use.

Something like If TextBox8 has Focus Then ???
Please advise
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Thought this would do what i requite but no

Rich (BB code):
    Private Sub TextBox8_Click()
       If TextBox11.Value > 0 Then
          TextBox11.Value = ""
          End If
    End Sub
 
Upvote 0
This wouldnt also work

VBA Code:
    Private Sub TextBox8_GotFocus()
       Me.TextBox11.Value = ""
    End Sub

Or this

Code:
    Private Sub TextBox8_GotFocus()
       Me.TextBox11.ClearContents
    End Sub

I will await a reply Thanks
 
Upvote 0
In the VB editor, do you see Click or GotFocus in the TextBox8 drop down list of events ?
 
Upvote 0
Not back for a couple hours so will need to check then.
In my previous posts above I did use click & Got Focus but is it written then incorrectly as I typed it out as opposed to selecting it from where your asking to look.
 
Upvote 0
The 2 text boxes I mention are both on the same userform.
 
Upvote 0
VBA Code:
Private Sub TextBox8_AfterUpdate()
Me.TextBox11.Value = ""
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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