UserForm_Initialize? How to update.
Settting the textbox's ControlSource creates a link between the textbox and
the cell. It's read/write in both directions. Changes made in the cell are
passed to the textbox and changes made in the textbox are passed to the
cell.
Private Sub Userform_initialize()
Title.ControlSource = "Sheet1!C1"
SamTitle.ControlSource = "Sheet1!E3"
Sam1.ControlSource = "Sheet1!E4"
Sam2.ControlSource = "Sheet1!E5"
End Sub
or to simply link the controls to the sheet that is active when the form is
shown, remove the sheet designations:
Private Sub Userform_Initialize()
Title.ControlSource = "C1"
SamTitle.ControlSource = "E3"
Sam1.ControlSource = "E4"
Sam2.ControlSource = "E5"
End Sub
In addition, setting ControlSource with VBA code is temporary, so when the
form is unloaded the link is broken. To create a permanent link, set the
ControlSource manually in the VBE.
"Jelso" wrote in message
om...
Question: If I use UserForm_Initialize when calling up a form with
text boxes, the text boxes won't update if their source cells change.
Is there some other word/commmand I should use instead of "Initialize"
to have the text boxes update with new data? Or is the problem
elsewhere?
Thanks..SJ
------------------------------------
Private Sub UserForm_Initialize()
Title.Text = Range("C1").Value
SAMTitle.Text = Range("E3").Value
SAM1.Text = Range("E4").Value
SAM2.Text = Range("E5").Value
-----------------------------------
|