View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Loading values into a form on open.

You must load the values in a event in the userform
Only load the Userform when you click the autoshape

Use this event in the Userform module

Private Sub UserForm_Initialize()
Me.TextBox1.Value = Sheets("Sheet1").Cells(25, 3).Value
End Sub



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"J. Vandenberg" wrote in message om...
At the moment I have a form that opens with a button click. It's not a
Private Sub because the button I am using is an autoshape which just
has the macro assigned to it.

Sub newdayBtn_Click()
Application.ScreenUpdating = False
dailyFrm.Show 0 // Tried running it non modal too.

// Then I want it to load values on open into text boxes from cells in
a sheet.

Sheets("Data").Activate
dpr1 = Cells(25, 3)
dpr2 = Cells(25, 4)

// The dpr's are text box names. The thing is, unless I add another
action, ie. tab change, or form click, it will not load the values.

// I thought maybe a repaint would make them show up, but nada. I am
not sure how to initialize the form without a seperate routine, is
there a simple way to make this happen in one click?

Thanks,
-Joel