Update user form labels

G

Guest

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?
 
N

NickHK

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
 
B

Bob Phillips

Use the Textbox AfterUpdate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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