![]() |
Update user form labels
I have a user form where the user enters a number into a textbox1 which is
linked to cell H2 in the work sheet. This then changes the result of another cell "N2". I want this result to be shown on the user form. At the moment i have a label to display the result with code as follows: Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Me.Label1.Caption = ActiveSheet.Range("n2") End Sub This works fine but in order for the value to be updated you have to move the mouse over the label. Can the label be updated as soon as the value is typed into the textbox1? |
Update user form labels
Jim,
Why not use a TextBox (possible with .Enabled=False or .Locked=True) and set it controlSource. This assumes that you are showing the userform with vbModeless. NickHK "Jim" wrote in message ... I have a user form where the user enters a number into a textbox1 which is linked to cell H2 in the work sheet. This then changes the result of another cell "N2". I want this result to be shown on the user form. At the moment i have a label to display the result with code as follows: Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Me.Label1.Caption = ActiveSheet.Range("n2") End Sub This works fine but in order for the value to be updated you have to move the mouse over the label. Can the label be updated as soon as the value is typed into the textbox1? |
Update user form labels
Use the Textbox AfterUpdate event.
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jim" wrote in message ... I have a user form where the user enters a number into a textbox1 which is linked to cell H2 in the work sheet. This then changes the result of another cell "N2". I want this result to be shown on the user form. At the moment i have a label to display the result with code as follows: Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Me.Label1.Caption = ActiveSheet.Range("n2") End Sub This works fine but in order for the value to be updated you have to move the mouse over the label. Can the label be updated as soon as the value is typed into the textbox1? |
All times are GMT +1. The time now is 11:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com