• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Reset Combobox in Userform with vlookup use

delta

Member
in userform
Party Name combobox name is "TB1"
SGST NO TextBox name is "TB2"
CGST NO TextBox name is "TB3"

how Combobox Value Reset (e.g. Nothing selected) when user click reset button.
i attached sample file for more clarification.
 

Attachments

  • FORM .xlsm
    22.7 KB · Views: 11
Code for Reset button
Code:
Private Sub CommandButton2_Click()
Dim Ctrl As Control
For Each Ctrl In Controls
    If TypeName(Ctrl) = "TextBox" Or TypeName(Ctrl) = "ComboBox" Then Ctrl.Value = ""
Next Ctrl
End Sub
and code for TB1
use Click event instead of Change event
Code:
Private Sub TB1_Click()
Dim dataRng As Range
Set dataRng = Worksheets("BAZE").Range("A2:C6")
TB2.Value = Application.WorksheetFunction.VLookup(TB1, dataRng, 2, 0)
TB3.Value = Application.WorksheetFunction.VLookup(TB1, dataRng, 3, 0)
End Sub
 
nice answer
a little issue is rise why allow other name instead refRng Range "A2:A6" in TB1 combobox.
 
Back
Top