Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Textbox on user form in Excel VBA

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...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Textbox on user form in Excel VBA

Textbox3.Visible = Val(Textbox2.Text) < Val(Textbox1.Text)

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Gimp" wrote in message
oups.com...
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...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Textbox on user form in Excel VBA


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Textbox on user form in Excel VBA

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

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

"Gimp" wrote in message
oups.com...
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...



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Textbox on user form in Excel VBA

Thanks Bob

Your suggestion lead me to this:

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

Works like a champ!!


Bob Phillips wrote:
Textbox3.Visible = Val(Textbox2.Text) < Val(Textbox1.Text)

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Gimp" wrote in message
oups.com...
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...


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can a TextBox on a user form activate a popup calander for dat JohannM Excel Programming 0 September 8th 06 09:36 AM
textbox on user form Mike Excel Programming 3 December 2nd 05 04:43 PM
User Form in VB = TextBox Kel Excel Discussion (Misc queries) 1 August 11th 05 12:26 AM
Textbox trouble on a user form Oreg[_3_] Excel Programming 7 May 27th 04 12:36 AM
User Form textbox formatting Neal[_2_] Excel Programming 0 August 20th 03 08:14 PM


All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"