Label Caption Does Not Appear Until Label Is Clicked

TheKernz

New Member
Joined
May 13, 2014
Messages
11
Hi everyone,
this is my first time posting to this forum and I'm still mostly a VBA noob, so bare with me.
I created a userform where if a value from cell x is true then the label caption changes to value in cell z. While everything works fine, the label caption does not seem to appear in my userform until i click on the label. Is there anyway that it can appear automatically once the userform opens?
Thanks

Also example of my code is:

Private Sub EventDateResult_Click ()
If Range("A5") = "1" Then
Me.EventDateResult.Caption = Range("N4")
End If
End Sub
 
Hi Try this in the Activation Event for your Userform

Code:
Sheets("sheet1").Activate
If ActiveSheet.Range("A5") = 1 Then
UserForm1.yourlabelname.Caption = ActiveSheet.Range("N4")
End If

Regards

Kev
 
Upvote 0
You could try
Code:
Private Sub EventDateResult_Click ()
If Range("A5") = "1" Then
    Me.EventDateResult.Caption = Range("N4")
    Me.Repaint
End If
End Sub
 
Upvote 0
Thanks mikerickson. The me.repaint, combined with a userform_initialize() line of code did the trick.
 
Upvote 0

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