In Excel UserForm, how do I update the caption label?

I created my first model UserForm in Excel and put an ActiveX shortcut on it. How to set the label on the label so that it displays everything that is in Sheet1.Range("A1") , and is updated when the value in cell A1 changes?

Basically, I want the Userform's label to always be updated, the second thing in the Excel cell is changing. Thanks!

+4
source share
2 answers
 Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Cells(1, 1), Target) Is Nothing Then Exit Sub End If UserForm1.Label1.Caption = Sheet1.Range("A1").Value End Sub 

Sub Change is called every time a cell changes. The code does this: if A1 been changed, change the Label1 to UserForm1 . The form should not be opened modally ( vbModeless ).

 UserForm1.Show vbModeless 
+4
source

This worked for me.

 Sheets("Sheet").Shapes("TheNameOfTheLabel").TextFrame.Characters.Text = "Hello" 
+1
source

All Articles