Events For Text Box To Get Focus

jo15765

Well-known Member
Joined
Sep 23, 2011
Messages
591
I am using the
Code:
textbox1_Enter()
event which fires when the text box is entered, but how can I account for if the data in the text box is cleared?

What I am after is anytime the text box is clicked, or cleared have a message box pop-up. What would be the best way tod o this?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
40,369
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
You can use the Change event and test for "" as the value.
 
Upvote 0

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,836
Office Version
  1. 2010
Platform
  1. Windows
In the VBE in the code module for the form, if you select the control in the left dropdown, the right dropdown shows the events for the control and will create the signature for the event handler.
 
Last edited:
Upvote 0

jo15765

Well-known Member
Joined
Sep 23, 2011
Messages
591
In the VBE in the code module for the form, if you select the control in the left dropdown, the right dropdown shows the events for the control and will create the signature for the event handler.

Very interesting, I had forgotten about this feature as I have been away from Excel VBA dev lately.
 
Upvote 0

Forum statistics

Threads
1,190,916
Messages
5,983,564
Members
439,849
Latest member
Tlaw

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
Top