Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Protected text boxes in Excel 1

Status
Not open for further replies.

nickjar2

Programmer
Joined
Jun 20, 2001
Messages
778
Location
US
Probably another easy question, but Excel is not my strong point.

If I have 2 text boxes, say txt1 and Txt2. I want to type something into txt1, and have it search an array for that value. If found, it will type in some value into txt2. If not found, it will put 'Not Found' into txt2. How can I then easily prevent users from manually typing into txt2. I suppose i could protect and unprotect in code. I suppose i also could have used VLookup aswell.

Cheers 4 any response. Nick (Everton Rool OK!)
 
Cheers Carr,

But all my text boxes are locked (and the sheet is protected). I am still able to type in anything into the text boxes.

All I need is a textbox to get populated via code, but no-one can manually enter data into it.

Cheers! Nick (Everton Rool OK!)
 
Hmmm...I may have assumed something I shouldn't have. How are creating your text boxes?? (drawing toolbar, control toolbox??)
 
Nick
have you tried using code on workbbok open as shown below

Private Sub Workbook_Open()
Sheets("yoursheetname").Protect ("yourpassword"), UserInterfaceOnly:=True

This will protect the cells from being directly edited however you will then need to create a userform in order to insert data into any cells that you want the info in


End Sub Regards

Paul
 
Sorry, Silly Me I did not read the question properly. Ignore my reply I thought you were entering data into a form and then the data was transferred to cells in a worksheet. Regards

Paul
 
Hiya,

If you're using the Textbox from the ControlToolbox (& I would ... ;-))set the ENABLED property of textbox2 to FALSE
Your users cannot enter anything; you can use the events of the first toolbox to activate the Lookup on the array & enter the result in your disabled textbox

HTH

Cheers
Nikki ;-)
 
Nikki,

Exactly what I was after.

Thanks, and thanx to everyone. Nick (Everton Rool OK!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top