Executing code when a textbox is selected

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
How to I execute code if a textbox is clicked in so the cursor appears on a locked sheet?

I want to unprotect my worksheet when a textbox has the cursor placed in it to type and protect it when the user has finished typing in it.


If you can't do that, can you protect a sheet but unprotect a textbox, allowing you to press enter to go to a new line while the sheet is protected?
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
If you want to still be able to edit a textbox on a protected sheet just check "Edit objects" in the Protect Sheet dialog window.
 
Upvote 0
That doesn't allow me to press enter and take me to a new line. If I press enter, the screen goes to the very last row in the workbook, about 11,000. If I scroll up, there is still no new line under the current text in the textbox.
 
Upvote 0
Try using SHIFT +Enter in the TextBox to start a new line
 
Upvote 0
Was the textbox active ?
Did you place the cursor within the texbox before pressing SHIFT + Enter ?
 
Upvote 0
I clicked in the text box and pressed shift + enter
 
Upvote 0
Ah, is this a ActiveX textBox or a standard TextBox
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,513
Members
448,967
Latest member
screechyboy79

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