Hi
If I want the user to only enter a percentage into an input box what is the best way to do this.
Kind regards
Keith
Hi
If I want the user to only enter a percentage into an input box what is the best way to do this.
Kind regards
Keith
In what format will it be entered?
As a number followed by %
just as a number without the %
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assistedor failed to assist you
I welcome your Feedback.
thanks
as a number followed by a %
You will need to test for several different entries
In the above code a space between the number & the % symbol will test as a valid entry. A space anywhere else will not pass the test![]()
With Me.TextBox1 If .Value = "" Then Exit Sub End If If Not Right(.Value, 1) = "%" Then Exit Sub End If If Not IsNumeric(Left(.Value, Len(.Value) - 1)) Then Exit Sub End If End With
If you want to test for a space between the number & the % then also use
before the End With command![]()
If InStr(.Value, " ") > 0 Then Exit Sub End If
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks