Disabling Textboxes Based On Other Textbox

glerwell

Well-known Member
Joined
Jun 25, 2006
Messages
1,080
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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,299
Office Version
  1. 365
Platform
  1. Windows
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.
 

glerwell

Well-known Member
Joined
Jun 25, 2006
Messages
1,080
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
 

Watch MrExcel Video

Forum statistics

Threads
1,133,325
Messages
5,658,162
Members
418,430
Latest member
Chlwls808

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