R
Robert Crandal
My userform contains various text label controls which display
the contents of a row of cells. I achieve this with the following code:
Private Sub Worksheet_Change (ByVal Target As Range)
UserForm1.Label1.Caption = Sheet1.Range("A1").Value
UserForm1.Label2.Caption = Sheet1.Range("B1").Value
UserForm1.Label3.Caption = Sheet1.Range("C1").Value
' ....
' etc, etc...
End Sub
I was wondering, is it wise to run the above code even when
my userform is not loaded??? The code above seems to
work fine even when my form is NOT loaded, but I'm worried
that trying to set the text of a label that doesn't exist will
cause bugs later on.
thank you
the contents of a row of cells. I achieve this with the following code:
Private Sub Worksheet_Change (ByVal Target As Range)
UserForm1.Label1.Caption = Sheet1.Range("A1").Value
UserForm1.Label2.Caption = Sheet1.Range("B1").Value
UserForm1.Label3.Caption = Sheet1.Range("C1").Value
' ....
' etc, etc...
End Sub
I was wondering, is it wise to run the above code even when
my userform is not loaded??? The code above seems to
work fine even when my form is NOT loaded, but I'm worried
that trying to set the text of a label that doesn't exist will
cause bugs later on.
thank you