Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm_Initialize? How to update.
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 ----------------------------------- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm_Initialize? How to update.
Jelso,
The form should open with the values from the cells in the textboxes. Are you changing the cell value after you initialize the form? If so, after you've changed the cell values try (in a Sub): Myuserform.repaint. If that doesn't do it then just get the values again Private Sub DoSomething_click() 'change the values in the cells Range("C1").Value = Range("C1").Value +3 Range("E3").Value = Range("E3").Value*3 Range("E4").Value = Range("E4").Value -3 Range("E5").Value = Range("C1").Value + Range("E3").Value +Range("E4").Value 'reset the textboxes Title.Text = Range("C1").Value SAMTitle.Text = Range("E3").Value SAM1.Text = Range("E4").Value SAM2.Text = Range("E5").Value End Sub HTH Henry "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 ----------------------------------- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 ----------------------------------- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Update one worksheet tab to automatically update all other tabs? | Excel Worksheet Functions | |||
Data Validation lists update orginal cell with list update | Excel Worksheet Functions | |||
i want to update one excel file the other one update automaticaly | New Users to Excel | |||
Update / don't update dialog box | Excel Worksheet Functions | |||
Date update on data update | Excel Programming |