Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default text box percent field

is there a way to have a text box on a userform automatically be set up to
receive a percent number amount? a user would be typing in, say...40%. i
would like if the text box could already have a percent sign and whatever
they type in the text box would be followed by that percent sign. i tried,
Userform.TextBox.Value = Userform.TextBox.Value & "%"
but that just repeated itself until the character max was filled. TIA.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default text box percent field

Userform.TextBox.Value =
Application.Substitute(Userform.TextBox.Value,"%", "") & "%"

--
Regards,
Tom Ogilvy

"Spencer Hutton" wrote in message
...
is there a way to have a text box on a userform automatically be set up to
receive a percent number amount? a user would be typing in, say...40%. i
would like if the text box could already have a percent sign and whatever
they type in the text box would be followed by that percent sign. i

tried,
Userform.TextBox.Value = Userform.TextBox.Value & "%"
but that just repeated itself until the character max was filled. TIA.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default text box percent field

Spencer,

You could try this.

Private Sub textbox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger
ByVal Shift As Integer) 'tab key
Application.ScreenUpdating = False
If KeyCode = "9" Or KeyCode = "13" Then
With UserForm1
.TextBox1.Text = .TextBox1.Text & " " & "%"
End With
End If
End Sub

When the user tabs off or press the enter key the % will be placed i
the textbox.

Charle

--
Message posted from http://www.ExcelForum.com

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
Combining Percent with Text Rodman Excel Discussion (Misc queries) 5 March 3rd 10 08:09 PM
Trouble sorting first by a dates field and then by a text field. trainer07 Excel Discussion (Misc queries) 1 December 6th 06 12:25 AM
Changing a text field to a date field juliet New Users to Excel 4 February 21st 06 09:52 PM
How to keep leading zero without changing field to text field? Deni Excel Discussion (Misc queries) 1 October 24th 05 10:48 PM
HELP!! Populate text in single XL field, or bulk copy text into 1 field filmfatale[_2_] Excel Programming 0 December 9th 03 02:30 PM


All times are GMT +1. The time now is 05:04 PM.

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"