Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jason Perry   on Dec 21 In MS Office Category.

  
Question Answered By: Priscilla Lewis   on Dec 21

I will play around with your suggestions to see if I
can get additional functionality out of the user form. For now, I
have it working by setting the value of a variable inside the Change
event, and then calling upon that value in the main procedure. Like
such:

Private Sub txtTotalYards_Change()
> > Dim TotalYards As Integer
> > TotalYards = 0
> > For i = 1 To 8
> > If Me("txtOpt" & i & "Yards").Text <> "" Then
> > TotalYards = TotalYards + _
> > Me.txtBalYards.Text + _
> > Me("txtOpt" & i & "Yards").Text
> > End If
> >
> > Next i
> > Me.txtTotalYards.Text = TotalYards
> > End Sub

and then in the main procedure:

Private Sub cmdCalculate_Click()
[other code]
Me.txtTotalYards.Value = TotalYards
End Sub

I'm sure that there's a better way to do it, and I'll continue
polishing my VBA with suggestions like yours, but for now, it works,
and I'm satisfied. Thanks again for your suggestions.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Sum values entered into text boxes Or get search suggestion and latest updates.


Tagged: