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
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,733
Office Version
365
Platform
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,220
Messages
5,509,898
Members
408,760
Latest member
DoktorPhill

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top