Userform label captions - Problems with repaint / updating values

Alex Simmons

New Member
Joined
Dec 3, 2012
Messages
17
Hi, help please!

I have a multitab userform with various controls.

One control is a listbox, and the user can choose (in this case) Male or Female, and that's linked to a control source cell in my workbook, and it updates the linked cell just fine.

Other cells in the workbook then adjust their values based on various formulas.
e.g. one such individual cell with range name "FTP_Ranking" will vary depending on whether the sex of the client is male or female (it's an athletic ranking using a lookup table). Again the worksheet cell updates just fine based on the userform listbox choice.

On the userform I have various label captions which I want to update and display the information calculated in the workbook. These label captions appear on different tabs on the userform.

One example is a userform label named "CaptionFTPrating", which I want to display the content of the calculated workbook cell with range name of "FTP_Ranking".

So I have a private sub listbox change event handler code as follows:

Code:
Private Sub ListBox1_Change()

    Me.CaptionFTPrating.Caption = Range("FTP_Ranking")
    Me.Repaint

End Sub

I've also tried:

Code:
Private Sub ListBox1_Click()

    Me.CaptionFTPrating.Caption = Range("FTP_Ranking")
    Me.Repaint

End Sub

Neither change event code updates the label caption when I click on the listbox to change the option - either a click, a double click, click then hit enter, none of them updates the label caption.

Note that the label caption "FTP_Ranking" is on a different tab in the same userform to the listbox. There are many label captions on various tabs I need to update.

I thought this was the way to auto update captions but it seems not. Any suggestions?

Do I need to perform a repaint for each individual tab on the userform? If so, I don't know how I would do that.

Thanks for any help.
 
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I found a solution to repaint not updating the labels on other tabs:

I created an event handler code for when you click on the userform page with the multiple tabs:

Code:
Private Sub MultiPage1_Click(ByVal Index As Long)
    UserForm_Initialize
End Sub
UserForm_Initialize contains code that updates all the values of labels.

You can just see it happen on screen when you click to another tab, the new tab shows and then the label captions in that tab are updated. Be nice if they could be updated before viewing the tab contents though.

Anyway, if there is a better way, I'm all ears!
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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