kevindorward_dfsdanf
New Member
- Joined
- Nov 5, 2019
- Messages
- 9
Hi,
I'm trying to get a userform label to update after selecting a bunch of comboboxes to give me a file name.
The file name is made up of acronyms that the vlookup is searching for e.g. General = GEN so when I click General in my dropdown combobox, that portion of the filename is entered in Label 8 and so on.
The problem is that I need to click on the label to show the resulting file name. How can I update this automatically? I have tried Me.Repaint & DoEvents to no avail.
I also had this but it does the same thing
I'm trying to get a userform label to update after selecting a bunch of comboboxes to give me a file name.
The file name is made up of acronyms that the vlookup is searching for e.g. General = GEN so when I click General in my dropdown combobox, that portion of the filename is entered in Label 8 and so on.
The problem is that I need to click on the label to show the resulting file name. How can I update this automatically? I have tried Me.Repaint & DoEvents to no avail.
VBA Code:
Private Sub Label8_Click()
If Me.ComboBox1 = "" Or Me.ComboBox2 = "" Or Me.ComboBox3 = "" Or Me.ComboBox4 = "" Or Me.ComboBox5 = "" Or Me.ComboBox6 = "" Then Exit Sub
Label8.Caption = Application.WorksheetFunction.VLookup(Me.ComboBox1, Sheet3.Range("A2:B3"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox2, Sheet4.Range("A2:B83"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox3, Sheet2.Range("A2:B9"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox4, Sheet5.Range("A2:B131"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox5, Sheet6.Range("A2:B70"), 2, 0) & Formatted_Num
End Sub
I also had this but it does the same thing
VBA Code:
Private Sub Label8_Click()
If Me.ComboBox1 = "" Or Me.ComboBox2 = "" Or Me.ComboBox3 = "" Or Me.ComboBox4 = "" Or Me.ComboBox5 = "" Or Me.ComboBox6 = "" Then Exit Sub
With Me
.Label8 = Application.WorksheetFunction.VLookup(Me.ComboBox1, Sheet3.Range("A2:B3"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox2, Sheet4.Range("A2:B83"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox3, Sheet2.Range("A2:B9"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox4, Sheet5.Range("A2:B131"), 2, 0) & "-" & Application.WorksheetFunction.VLookup(Me.ComboBox5, Sheet6.Range("A2:B70"), 2, 0) & Formatted_Num
End With
End Sub