change label on multipage

K

koenigma

I have a Userform with a Multipage on it. On the first page of the
Multipage I have a combobox. What I would like to do is based upon the
value of the combobox on the 1st page change the text of a label on
Page 2.

Is this possible, and if so how, I have tried to Code below but it does
not work.

If MultiPage1.Pages(0).cboTestType.Value = "Groove Weld" then
MultiPage1.Pages(1).lblWeldType.Caption = "Groove Weld"
else
MultiPage1.Pages(1).lblWeldType.Caption = "Fillet Weld"
End if

Regards
Martin
 
G

Gary Keramidas

i just use the label name. thi label is on the 2nd page and depending on if the
checkbox next to it is checked, it dispaly as value

If Worksheets("work").Range("u2").Value = True Then
Me.CheckBox2 = True

With Me.Label2
.Caption = "Click to disable Menu load on startup."
.Height = 20
.Width = 80
.Left = 75
End With

GoTo Fin:

Else

Me.CheckBox2 = False
With Me.Label2
.Caption = "Click to load Menu on startup."
.Height = 20
.Width = 80
.Left = 75
End With
End If
Fin:
 
M

Mike Fogleman

Here is a generic example. You will need to change the object names as
needed.
This code belongs to your combobox_change event code.

Private Sub ComboBox1_Change()
If Me.ComboBox1.Value = "Groove Weld" Then
Me.Label1.Caption = "Groove Weld"
Else
Me.Label1.Caption = "Fillet Weld"
End If
End Sub

Mike F
 
T

Tom Ogilvy

your code worked fine for me:


Private Sub cboTestType_Click()
If MultiPage1.Pages(0).cboTestType.Value = "Groove Weld" Then
MultiPage1.Pages(1).lblWeldType.Caption = "Groove Weld"
Else
MultiPage1.Pages(1).lblWeldType.Caption = "Fillet Weld"
End If

End Sub

Private Sub UserForm_Initialize()
cboTestType.AddItem "Groove Weld"
cboTestType.AddItem "Fillet Weld"
End Sub
 

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