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
 
Try this. With full arguments.
VBA Code:
Private Sub TextBox8_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox11.Value = ""
End Sub
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Dont know what you mean by full arguments,i copied it like above but text still in textbox
 
Upvote 0
Not sure i understand that last code.
Look at this,

When the user clicks in the textbox shown by arrow it should then remove the XXXXX above

EaseUS_2024_11_ 8_23_53_18.jpg
 
Upvote 0
Yeah. I don't think that I'm grasping what you are trying to accomplish. I will submit this last attempt. If you type a value in TextBox8 and then select TextBox11 the text in TextBox8 will disappear.
VBA Code:
Private Sub TextBox11_Enter()
Me.TextBox8.Value = ""
End Sub
 
Upvote 0
Solution
No neither are there ?
That's because neither are events associated with text boxes.
Try using Enter for tab, enter key or arrow key taking you to the other textbox
or MouseDown if you only want clicking into the other textbox
 
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