I have a text box and a check box on userform... how to make one change reflect the other object

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
476
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
userform activex objects;

my code; not working... "object required" error (I have also tried putting "Me." in front of the object names
Code:
Private Sub chkBOX_Click()
[COLOR=#008000]'[B] If CHECKBOX field is checked (Yes), then clear the TEXTBOX field contents:[/B][/COLOR]
If chkBOX = True Then txtBOX.Value = Null Else
End Sub


Private Sub txtBOX_Change()
[B][COLOR=#008000] is[/COLOR][COLOR=#008000]' If TEXTBOX field is NOT NULL (contains at least 1 ccharacter of something, then clear the CHECKBOX so it[/COLOR][/B][COLOR=#008000] [B]NULL:[/B][/COLOR]
If txtBOX.Value Is Not Null Then chkBOX = Null Else
End Sub

What I am wanting to do is this:

WHen something is typed into the text field, it automatically clears the checkbox beside it.

So basically when the checkbox is checked, it clears the corresponding textbox of any contents;
If anything IS typed in the textbox, then it clears the checkbox. (one affects the other.)

Like I said, I am getting an error with the above code. THanks for any help.
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try
Code:
Private Sub txtBOX_Change()
If txtBox.Value <> "" Then chkBox = False
End Sub
 
Last edited:
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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