ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data validation within a userform (https://www.excelbanter.com/excel-programming/355291-data-validation-within-userform.html)

kjenner7

Data validation within a userform
 

:confused: HELP!! Doing A Level ICT finished my project, just adding
the final touches i.e validation.

I have data entry in a userform via textboxes and comboboxes. I need to
validate these under specific criterias. How do I go about doing this?

Any help greatly appreciated.

Thanks
Kate


--
kjenner7
------------------------------------------------------------------------
kjenner7's Profile: http://www.excelforum.com/member.php...o&userid=32216
View this thread: http://www.excelforum.com/showthread...hreadid=519656


Toppers

Data validation within a userform
 
Kate,
Can you give example(s) of validation(s) required as there are a
number of ways of doing these e.g IF ..THEN .. ELSE, CASE ...

"kjenner7" wrote:


:confused: HELP!! Doing A Level ICT finished my project, just adding
the final touches i.e validation.

I have data entry in a userform via textboxes and comboboxes. I need to
validate these under specific criterias. How do I go about doing this?

Any help greatly appreciated.

Thanks
Kate


--
kjenner7
------------------------------------------------------------------------
kjenner7's Profile: http://www.excelforum.com/member.php...o&userid=32216
View this thread: http://www.excelforum.com/showthread...hreadid=519656



kjenner7[_2_]

Data validation within a userform
 

Its things like only allowing the user to enter a number with no mor
than 2 decimal places. I think the code for VBA is something like:

a = Format(TextBox1.Value, "#,###.00")

but that doesn't seem to be working.
I had some other validation issues aswell but i've been able to wor
those out now, just having trouble with this decimal one and also s
that they can only enter numbers not text

--
kjenner
-----------------------------------------------------------------------
kjenner7's Profile: http://www.excelforum.com/member.php...fo&userid=3221
View this thread: http://www.excelforum.com/showthread.php?threadid=51965


[email protected]

Data validation within a userform
 
You want to use the change action of the combo box/text box then use
something like this to check the value entered.

I would not try to force the user to 2 decimals, but instead round
whatever they enter to two decimals.

Private Sub ComboBox1_Change()
'check that is a number
If Not IsNumeric(Me.Value) Then
MsgBox "Must be a number"
'check for decimal count
Else
Me.Value = Round(Me.Value, 2)
End If
End Sub


kjenner7[_3_]

Data validation within a userform
 

:) Yep, thanks for the help i've sorted it all out now. Cheers.
Kate


--
kjenner7
------------------------------------------------------------------------
kjenner7's Profile: http://www.excelforum.com/member.php...o&userid=32216
View this thread: http://www.excelforum.com/showthread...hreadid=519656



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com