none
How to Return Value to Text Box based on checked state of check box? RRS feed

  • Question

  • Hi Folks,

    I've scoured the forums and although I'm sure its easy, I am new, and cannot figure it out. Please help. If a check box (CheckBox1) is checked (true) I want to return the text "N/A" to a defined Text Box (FixPos2).

    If not checked, don't do anything to the text box.

    Current Code;

    Private Sub CheckBox1_Change()
    If CheckBox1 = True Then FixPos2 = "N/A"
    End Sub

    NB I already have code attributed to "FixPos2" where the value in the user form automatically populates into a named cell in a spreadsheet;

    Private Sub FixPos2_Change()
    Range("input3.14").Value = FixPos2.Value
    End Sub

    Thanks in advance!!

    Tuesday, March 24, 2015 11:19 AM

Answers

  • Hello,

    It is not clear whether you develop a VBA macro or add-in. Try using the following code:

    If CheckBox1.Checked = True Then FixPos2.Text = "N/A"

    • Marked as answer by MrsMaker Tuesday, March 24, 2015 1:24 PM
    Tuesday, March 24, 2015 12:20 PM

All replies

  • Hello,

    It is not clear whether you develop a VBA macro or add-in. Try using the following code:

    If CheckBox1.Checked = True Then FixPos2.Text = "N/A"

    • Marked as answer by MrsMaker Tuesday, March 24, 2015 1:24 PM
    Tuesday, March 24, 2015 12:20 PM
  • Thank you Eugene, that works well, its was VBA in an Excel userform.
    Tuesday, March 24, 2015 1:25 PM