How to link option buttons with textboxes in VB? [closed]











up vote
-4
down vote

favorite












I want to prevent people using my userform in VBA from filling up textboxes until they choose an option button(I have three options). Can someone give me the code for that?










share|improve this question















closed as too broad by Cindy Meister, Storax, Davesexcel, Pᴇʜ, K.Dᴀᴠɪs Nov 13 at 0:50


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • If my answer has not helped you, you'll need to tell us more about your problem
    – Marcucciboy2
    Nov 11 at 5:22










  • It actually worked. Thanks! Thought I sent the message a few days ago though...
    – Bree
    Nov 13 at 18:04












  • Glad it helped! In the future you'll want to give us a bit more background into your problem, what you've tried in an attempt to fix it, etc
    – Marcucciboy2
    Nov 13 at 18:30












  • Sure will, as soon as I submit my countless class papers :)
    – Bree
    Nov 16 at 16:57















up vote
-4
down vote

favorite












I want to prevent people using my userform in VBA from filling up textboxes until they choose an option button(I have three options). Can someone give me the code for that?










share|improve this question















closed as too broad by Cindy Meister, Storax, Davesexcel, Pᴇʜ, K.Dᴀᴠɪs Nov 13 at 0:50


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • If my answer has not helped you, you'll need to tell us more about your problem
    – Marcucciboy2
    Nov 11 at 5:22










  • It actually worked. Thanks! Thought I sent the message a few days ago though...
    – Bree
    Nov 13 at 18:04












  • Glad it helped! In the future you'll want to give us a bit more background into your problem, what you've tried in an attempt to fix it, etc
    – Marcucciboy2
    Nov 13 at 18:30












  • Sure will, as soon as I submit my countless class papers :)
    – Bree
    Nov 16 at 16:57













up vote
-4
down vote

favorite









up vote
-4
down vote

favorite











I want to prevent people using my userform in VBA from filling up textboxes until they choose an option button(I have three options). Can someone give me the code for that?










share|improve this question















I want to prevent people using my userform in VBA from filling up textboxes until they choose an option button(I have three options). Can someone give me the code for that?







excel vba excel-vba






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 7:18









Pᴇʜ

18.9k42549




18.9k42549










asked Nov 10 at 22:42









Bree

1




1




closed as too broad by Cindy Meister, Storax, Davesexcel, Pᴇʜ, K.Dᴀᴠɪs Nov 13 at 0:50


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as too broad by Cindy Meister, Storax, Davesexcel, Pᴇʜ, K.Dᴀᴠɪs Nov 13 at 0:50


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • If my answer has not helped you, you'll need to tell us more about your problem
    – Marcucciboy2
    Nov 11 at 5:22










  • It actually worked. Thanks! Thought I sent the message a few days ago though...
    – Bree
    Nov 13 at 18:04












  • Glad it helped! In the future you'll want to give us a bit more background into your problem, what you've tried in an attempt to fix it, etc
    – Marcucciboy2
    Nov 13 at 18:30












  • Sure will, as soon as I submit my countless class papers :)
    – Bree
    Nov 16 at 16:57


















  • If my answer has not helped you, you'll need to tell us more about your problem
    – Marcucciboy2
    Nov 11 at 5:22










  • It actually worked. Thanks! Thought I sent the message a few days ago though...
    – Bree
    Nov 13 at 18:04












  • Glad it helped! In the future you'll want to give us a bit more background into your problem, what you've tried in an attempt to fix it, etc
    – Marcucciboy2
    Nov 13 at 18:30












  • Sure will, as soon as I submit my countless class papers :)
    – Bree
    Nov 16 at 16:57
















If my answer has not helped you, you'll need to tell us more about your problem
– Marcucciboy2
Nov 11 at 5:22




If my answer has not helped you, you'll need to tell us more about your problem
– Marcucciboy2
Nov 11 at 5:22












It actually worked. Thanks! Thought I sent the message a few days ago though...
– Bree
Nov 13 at 18:04






It actually worked. Thanks! Thought I sent the message a few days ago though...
– Bree
Nov 13 at 18:04














Glad it helped! In the future you'll want to give us a bit more background into your problem, what you've tried in an attempt to fix it, etc
– Marcucciboy2
Nov 13 at 18:30






Glad it helped! In the future you'll want to give us a bit more background into your problem, what you've tried in an attempt to fix it, etc
– Marcucciboy2
Nov 13 at 18:30














Sure will, as soon as I submit my countless class papers :)
– Bree
Nov 16 at 16:57




Sure will, as soon as I submit my countless class papers :)
– Bree
Nov 16 at 16:57












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Private Sub UserForm_Initialize()
TextBox1.Locked = True
End Sub

Private Sub UnlockTextbox()
If OptionButton1.value = True _
Or OptionButton2.value = True _
Or OptionButton3.value = True Then
TextBox1.Locked = False
End If
End Sub

Private Sub OptionButton1_Click()
UnlockTextbox
End Sub

Private Sub OptionButton2_Click()
UnlockTextbox
End Sub

Private Sub OptionButton3_Click()
UnlockTextbox
End Sub





share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Private Sub UserForm_Initialize()
    TextBox1.Locked = True
    End Sub

    Private Sub UnlockTextbox()
    If OptionButton1.value = True _
    Or OptionButton2.value = True _
    Or OptionButton3.value = True Then
    TextBox1.Locked = False
    End If
    End Sub

    Private Sub OptionButton1_Click()
    UnlockTextbox
    End Sub

    Private Sub OptionButton2_Click()
    UnlockTextbox
    End Sub

    Private Sub OptionButton3_Click()
    UnlockTextbox
    End Sub





    share|improve this answer



























      up vote
      0
      down vote













      Private Sub UserForm_Initialize()
      TextBox1.Locked = True
      End Sub

      Private Sub UnlockTextbox()
      If OptionButton1.value = True _
      Or OptionButton2.value = True _
      Or OptionButton3.value = True Then
      TextBox1.Locked = False
      End If
      End Sub

      Private Sub OptionButton1_Click()
      UnlockTextbox
      End Sub

      Private Sub OptionButton2_Click()
      UnlockTextbox
      End Sub

      Private Sub OptionButton3_Click()
      UnlockTextbox
      End Sub





      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        Private Sub UserForm_Initialize()
        TextBox1.Locked = True
        End Sub

        Private Sub UnlockTextbox()
        If OptionButton1.value = True _
        Or OptionButton2.value = True _
        Or OptionButton3.value = True Then
        TextBox1.Locked = False
        End If
        End Sub

        Private Sub OptionButton1_Click()
        UnlockTextbox
        End Sub

        Private Sub OptionButton2_Click()
        UnlockTextbox
        End Sub

        Private Sub OptionButton3_Click()
        UnlockTextbox
        End Sub





        share|improve this answer














        Private Sub UserForm_Initialize()
        TextBox1.Locked = True
        End Sub

        Private Sub UnlockTextbox()
        If OptionButton1.value = True _
        Or OptionButton2.value = True _
        Or OptionButton3.value = True Then
        TextBox1.Locked = False
        End If
        End Sub

        Private Sub OptionButton1_Click()
        UnlockTextbox
        End Sub

        Private Sub OptionButton2_Click()
        UnlockTextbox
        End Sub

        Private Sub OptionButton3_Click()
        UnlockTextbox
        End Sub






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 11 at 5:20

























        answered Nov 10 at 23:01









        Marcucciboy2

        2,25621022




        2,25621022