Userform: Update a Text Label when i click Value in Combobox

NessPJ

Active Member
Joined
May 10, 2011
Messages
418
Office Version
  1. 365
Hello there,

I'm trying to show a value/text in a Label on my Userform when the user clicks a certain value in a Combobox.

Worksheets have a _change value Event. Is there something similar for a Userform? I can't seem to find it...

This is some of the code i use: [Menu.Artikel1 is my Combobox]
VBA Code:
Dim RowART1 As Long
Dim LastRowTagART1 As Long
Dim ArtikelOmschrijving As String

LastRowTagART1 = ThisWorkbook.Sheets("Parameters").Range("M22").End(xlUp).Row


'De inhoud voor lijst met Artikelen wordt dynamisch opgebouwd (Combobox Artikel1).

    With Menu.Artikel1
    For RowART1 = 4 To LastRowTagART1
    .AddItem Sheets("Parameters").Range("M" & RowART1).Value
    Next RowART1
    End With

Something like this should be in a VBA routine/event when the Value changes and the field(s)/form is updated, i think: [Menu.ArtikelOmschrijving is my Text Label]
VBA Code:
    'Find(Searchstring As String, SearchSheet As String, SearchColumn As String)
 
    ArtikelOmschrijving = Find(Menu.Artikel1.Text, "Parameters", "M")
 
    Menu.ArtikelOmschrijving.Caption = ArtikelOmschrijving

Does anyone know how to do this? :)
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi, you can write VBA on Combobox change event in Userform itself.

VBA Code:
Private Sub Artikel1_Change()
If Artikel1.Value = "valuetocompare" Then
    ArtikelOmschrijving.Caption = "ChangedText"
End If
End Sub

For more information on Userform:
How to create Userform
 
Upvote 0
Solution

Forum statistics

Threads
1,215,078
Messages
6,122,996
Members
449,093
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top