Help! Refrence a userform element from a textbox?

S

Shaka215

How can I refrence the text inside of a textbox through VB coding...

Situation: I have 60 diffrent check boxes. When one of them is
pressed it does the following...

If CheckBox1.Value = True Then
CheckBox1.Enabled = False
TextBox1.Value = "CheckBox1"
End If

I have a commandbutton I would like to enable the checkbox# from
TextBox1 value... I've tried the following but it's probally not even
close.

Private Sub CommandButton1_Click()
Dim LOCK1 as String
LOCK1 = TextBox1.Value
Lock1.enabled = True
Exit Sub
End Sub

How can I get this to work?
 
J

Joel

This works for oleobjects
Worksheets("sheet1").OLEObjects("ListBox1").Delete


Private Sub CommandButton1_Click()
Dim LOCK1 as String
LOCK1 = TextBox1.Value
activesheet.oleobjects(lock1).enable = true

End Sub
 
T

Tim Zych

Dim ctrl as Control 'MSForms.Checkbox
Set ctrl = Me.Controls(LOCK1)
ctrl.Enabled = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top