View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jeff jeff is offline
external usenet poster
 
Posts: 48
Default Do Until - If-then problem

On Dec 4, 7:15*am, Don Guillett Excel MVP
wrote:
On Dec 3, 3:39*pm, "Clif McIrvin" wrote:





"jeff" wrote in message


....
Here s what I m trying to do. The user fills out UserForm6 that
already has a number in TextBox22 when it comes up. This number is
from a previous form. There are 16 TextBoxes in UserForm6, and the
user will enter numbers in some or all of these boxes. The idea is to
have the sum of these 16 boxes equal the number that was already in
TextBox22.


<code ... snipped


Am I close with either attempt? If anyone can help, I d appreciate
it.
Thanks,
jeff


***


Until someone with more experience chimes in here, my guess is that
something about TextBox23.Value = TextBox22.Value is never evaluating
True.


Have you tried setting a breakpoint at the If statement and using the
Locals window to compare the two values yourself?


Sonething that might work for you is:


Dim curBox23 as Currency
Dim curBox22 as Currency


(your code)


curBox22 = TextBox22.Value
curBox23 = TextBox23.Value


If (curBox23 - curBox22) < 0.001 Then


Just a thought. *From what I saw, both of your attempts should do what
you want.


--
Clif McIrvin


(clare reads his mail with moe, nomail feeds the bit bucket :-)


I didn't look at this closely but a modification of this idea should
do it.

Sub stoploop()
mr = 2
Do Until mv = Range("c1")
mv = mv + Cells(mr, "c")
MsgBox mv
mr = mr + 1
Loop
MsgBox mv
End Sub- Hide quoted text -

- Show quoted text -


I'll try this again. I just replied, but it didn't take
I apprecitate the replies I got. But, I just don't understand them
enough to know how to use the replies with what I have already. I'm
sure non of the suggestions were meant to replace my coding. But, as I
read them, I don't see how they could connect. Obviously I don't know
enough about the subject to see it.
Just to be clear on what I'm trying to do.
I want the user to fill in some or all of the 16 TextBoxes. After
that, the total of those will be added, and placed in TextBox 23. What
I want is for TextBox 23 to be compared to TextBox 22. If the values
are exactly the same, then it runs AllocateDeposit module. If they DO
NOT equal, then I want that message box to come up again, then the
user tries it again (by changing some of the entries in those 16
TextBoxes. Then he clicks OK again, and TextBoxes 22 & 23 are compared
gain.... this goes on over and over until TextBoxes 22 & 23 are
equal.
If someone could please enlighten me, I would appreciate it. Thanks
for the replies so far.
jeff