Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update one worksheet tab to automatically update all other tabs? shoechic1 Excel Worksheet Functions 1 May 24th 09 03:55 PM
Data Validation lists update orginal cell with list update [email protected] Excel Worksheet Functions 3 July 11th 08 07:56 AM
i want to update one excel file the other one update automaticaly Basant New Users to Excel 1 December 16th 06 12:50 AM
Update / don't update dialog box Tim Kredlo Excel Worksheet Functions 1 November 11th 04 04:25 PM
Date update on data update Chris Thompson Excel Programming 3 August 22nd 03 06:40 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"