Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Excel ActiveX TextBox Properties and Procedures 1

Status
Not open for further replies.

RobFlott

Instructor
Sep 26, 2012
1
US
I am working with Excel 2007 on Vista and I have an ActiveX TextBox on an Excel spreadsheet where the user inputs an 8 number ID. I am trying to fiugre the code so after the user enters their 8 number ID it calls a macro that clears a range on a separater worksheet and then returns to the original worksheet and I want it to focus on my first ListBox.

I am uncertain how to set the Properties of the TextBox, and also unclear which 'procedure' to use.

I appreciate any direction to solve this and also to any clearing house of information pertaining to ActiveX Controls

Thank you
 
The forum dedicated to vba is forum707.
Assuming that you need to clear a range in the same worksheet, the control is named TextBox1:
Code:
Private Sub TextBox1_Change()
If Me.TextBox1.Text Like "########" Then
    ' test textbox text here
    Me.Parent.Worksheets("SomeWsName").Range("A1:C3").Clear
Else
    If Len(Me.TextBox1.Text) = 8 Then
        MsgBox "wrong 8-character text"
    End If
End If
End Sub
Double-click the control in the sheet in design mode and you should get the frame of the event procedure.
There is no need to select destination sheet.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top