View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
C Petrin C Petrin is offline
external usenet poster
 
Posts: 6
Default Problem with TextBox & ControlSource - Please Help

Doublecheck your code and your property assignments. It's not really a
timing issue, and there's no need to refresh anything. Something like
this should work every time:

Sub DoForm()
Dim MyRange As Range
Set MyRange = Worksheets("MySheet").Rows(2)
MyRange.Insert shift:=xlDown
UserForm1.Show
End Sub

Even if you delay inserting a new blank row until you intialize the
form, it should still work:

Private Sub UserForm_Initialize()
Dim MyRange As Range
Set MyRange = Worksheets("MySheet").Rows(2)
MyRange.Insert shift:=xlDown
End Sub


wrote in message
...
I have a form which has a number of TextBoxes that have their

ControlSource
property set to various cells in row 2 of a worksheet.

The routine which displays the form begins by inserting a new row as

row 2
(.Insert shift=:xlDown) so that row 2 is blank.
It then does Application.Calculate (should not be necessary)
and finally shows the form.

The first time the form is displayed the TextBoxes show the values

that are
in row 3 rather than the blank values that are in row two. If I

change a
TextBox the corresponding in cell in row 2 changes as it should.

Why is the form displaying values in row 3 in TextBoxes whose

ControlSource
is set to row 2? How can I fix it.

MANY thanks for any help on this one.