View Single Post
  #8   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

The code you supplied works for me, at least on a simple userform (my
test form had 20 textboxes sourced to different values and formulas).
But I had to strip it down a bit (removed references to "mbrNo" and
"mbrName", and replaced your SetDesignationsVisible procedure by
directly setting the Visible property of various textboxes true/false),
so have a closer look there. Hard to say what's in
SetDesignationsVisible, but you might want to try running it from the
form's Initialize event instead, and see if that makes a difference.

wrote in message
...
I'm not sure exactly what code and property assignments I should

check.
Everything is working properly except that when the form comes up it

is
displaying values from the wrong row (row 3). If I change the value

of a
text box the new value is placed into its proper cell in row 2.

Therefore
the row source property is correct. The code you are saying should

work
properly every time is what is not working.

Sub EnterGift()
Dim i As Long
Dim s As String

If Range("G!B2") < "" Then 'Insert new line for new

donation
Worksheets("G").Rows("2:2").Insert Shift:=xlDown
Worksheets("G").Rows("2:2").Font.Bold = False
Range("G!E2:CH2").NumberFormat = "0.00"
End If
Worksheets("G").Calculate 'Failing attempt to get around

problem
Worksheets("G").Range("F2").Formula = "=SUM(G2:CH2)"

i = CurMbrRow
With EnterDonation
.Header.Caption = Range(mbrNo & i) & " - " & Range(mbrName &

i)
.gDate = DefaultDate
Range("G!A2") = Int(Range(mbrNo & i))
Range("G!B2") = Range(mbrName & i)
Application.Calculate 'Another failed attempt to solve

problem
End With
Call SetDesignationsVisible 'This makes some controls visible
EnterDonation.Show 'This shows values from row 3
End Sub

On Tue, 13 Jan 2004 03:20:57 -0500, "C Petrin"
wrote:

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