#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Textbox

How can I make sure that currency is only entered into text box on userform

Thanks mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Textbox

On Jun 26, 7:10 pm, Mike wrote:
How can I make sure that currency is only entered into text box on userform

Thanks mike


Hi, Mike:

Is it possible to pop up a message if your input is not a numerical
number?

Thanks,

George

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Textbox

How can I make sure that currency is only entered into
text box on userform


Do you mean you want to restrict what the user types in the TextBox to an
entry composed of at maximum, a single decimal point, digits characters (at
maximum, only two of them after the decimal point) and, at most, a single
currency symbol in character position 1 (with all other keystroke being
rejected)? What about thousands separator characters? Or did you have
something else in mind?

Rick

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Textbox

Rick thanks for the reply
I think I have got it but you may suggest something else

What I have done first is in the AfterUpdate event to takes care of the 99
or 110
dollar entry and turn into $99.00 $110.00
Private Sub txtIQPrice_AfterUpdate()
txtIQPrice.Value = Format(txtIQPrice.Value, "Currency")
End Sub

Then in the button click event I have this code to look at the non numeric
entries
If you think I might be missing something or if you foresee problems please
give suggestions

Thanks Mike

If IsNumeric(txtIQPrice.Value) = False Then
MsgBox "Must enter a valid dollar amount for" & " " _
& lblIQPrice.Caption & vbCrLf & txtIQPrice.Value _
& " " & "is not a valid entry", vbCritical, "360 Price Matrix"
Exit Sub

"Rick Rothstein (MVP - VB)" wrote:

How can I make sure that currency is only entered into
text box on userform


Do you mean you want to restrict what the user types in the TextBox to an
entry composed of at maximum, a single decimal point, digits characters (at
maximum, only two of them after the decimal point) and, at most, a single
currency symbol in character position 1 (with all other keystroke being
rejected)? What about thousands separator characters? Or did you have
something else in mind?

Rick


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Textbox

What does your code do if the user types the following in (parentheses,
dollar signs and all)?

($1,23,,3.4,,,5,,E267$)

Is it what you expected?

Rick



"Mike" wrote in message
...
Rick thanks for the reply
I think I have got it but you may suggest something else

What I have done first is in the AfterUpdate event to takes care of the 99
or 110
dollar entry and turn into $99.00 $110.00
Private Sub txtIQPrice_AfterUpdate()
txtIQPrice.Value = Format(txtIQPrice.Value, "Currency")
End Sub

Then in the button click event I have this code to look at the non numeric
entries
If you think I might be missing something or if you foresee problems
please
give suggestions

Thanks Mike

If IsNumeric(txtIQPrice.Value) = False Then
MsgBox "Must enter a valid dollar amount for" & " " _
& lblIQPrice.Caption & vbCrLf & txtIQPrice.Value _
& " " & "is not a valid entry", vbCritical, "360 Price Matrix"
Exit Sub

"Rick Rothstein (MVP - VB)" wrote:

How can I make sure that currency is only entered into
text box on userform


Do you mean you want to restrict what the user types in the TextBox to an
entry composed of at maximum, a single decimal point, digits characters
(at
maximum, only two of them after the decimal point) and, at most, a single
currency symbol in character position 1 (with all other keystroke being
rejected)? What about thousands separator characters? Or did you have
something else in mind?

Rick



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
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:47 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM
How to move cursor from one textbox control to another textbox con KMoore007 Excel Programming 0 September 16th 04 02:47 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


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

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

About Us

"It's about Microsoft Excel"