Disabling Textboxes Based On Other Textbox

glerwell

Well-known Member
Joined
Jun 25, 2006
Messages
1,082
Hi

How do I disable a textbox based on another textbox's value and disable that textbox too.

For example,

If Textbox2 equals 0.00 than disable both textboxes 1 and 2.

Also, is there a way that a textbox cannot be selected when the tab or return key is pressed with out actually disabling it. Such as removing it from the tab order.

If not could the above be done but using a label and textbox.

So if label1 equals 0.00 then disable textbox2 and label1.

thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
There are various ways to enable/disable controls and also various ways to avoid them being selected, tab to etc.

If you want to do something based on what's entered in a control then you are probably looking at some event code and the Enable property.

There are various events you could try - Change, Exit, AfterUpdate etc.

Those are for textboxes, and which to and how to use them really depends on what you want to do and when you want it to happen.

For the tabbing part most controls have TabIndex and TabStop properties, again how to use them depends on what you want to achieve.

PS Just remembered there's the Locked property too.
 
Upvote 0
Thanks Norie, I think I have an idea with the coding using change_event.

I didn't know about the tabstop property and have managed to ge that working.

Cheers
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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