Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Textbox on user form in Excel VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gimp - 16 Jan 2007 17:04 GMT
I have what I think is an easy one, but yet the solution fails me.  I
have three textboxes, 1, 2, 3.  Textbox3 is set in the propteries as
visible = false.  The code I wrote is quite basic:

if textbox2.value < textbox1.value then
Textbox3.visible = True
Else
if textbox2.value > textbox1.value then
textbox3.visible = false
End if
End if

I've tried other variations but nothing seems to work, work
consistantly that is.  The code in within a Sub...end sub where based
on the entry, t1 and t2 is populated with their values.  I've also
tried having the code in a commandbutton.  Still, same result,
sometimes it works, some times it does not.  Text1 and Text2 are both
dollar amounts, and text3 is text...'the total amount is less than the
subtotal amount...'

Thanks...
Bob Phillips - 16 Jan 2007 17:27 GMT
Textbox3.Visible = Val(Textbox2.Text) < Val(Textbox1.Text)

Signature

---
HTH

Bob

(change the xxxx to gmail if mailing direct)

>I have what I think is an easy one, but yet the solution fails me.  I
> have three textboxes, 1, 2, 3.  Textbox3 is set in the propteries as
[quoted text clipped - 17 lines]
>
> Thanks...
Gimp - 16 Jan 2007 17:59 GMT
Thanks Bob

Your suggestion lead me to this:

If CDbl(TextBox34.Text) < CDbl(TextBox30.Text) Then
TextBox44.Visible = True

Works like a champ!!

> Textbox3.Visible = Val(Textbox2.Text) < Val(Textbox1.Text)
>
[quoted text clipped - 27 lines]
> >
> > Thanks...
merjet - 16 Jan 2007 17:31 GMT
Not sure of your goal, but deleting the 3rd line and one of the End If
lines might achieve it. (If textbox2.value = textbox1.value, then
textbox3 will be invisible.)

Merjet
John Bundy - 16 Jan 2007 17:34 GMT
Try with just this

Private Sub TextBox1_Change()
If TextBox2.Value < TextBox1.Value Then
TextBox3.Visible = True
Else: TextBox3.Visible = False

End If

End Sub

Signature

--
-John
Please rate when your question is answered to help us and others know what
is helpful.

>I have what I think is an easy one, but yet the solution fails me.  I
> have three textboxes, 1, 2, 3.  Textbox3 is set in the propteries as
[quoted text clipped - 17 lines]
>
> Thanks...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.