Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unique data in control arrey of textboxes
I have a control arrey of 10 text boxes (from 0 to 9) on a form.
After user enters data in text boxes, and clicks on commandbutton "GO", I want to validate the data. Validation rules: 1. data must be numaric from 0 to 9 only 2. each number entered must be unique, duplicate numbers not allowed. 3. each number must start with 093 4. each number must have 11 digits, no more no less. If any rule is violated, I want to warn the user and want them to re-enter the data. The macro should proceed only when above criteria is meet with. Second problem is: I want to process only non blank textboxes. I can loop thru it but how can I ignore blank text boxes? Thanks for any help. Regards, Shetty |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unique data in control arrey of textboxes
Here is a very rough version of what you want...
Sub Trial() Dim DataEntered As String Dim Proceed As Boolean Proceed = True For K = 0 To 9 DataEntered = ControlNameK.Value If DataEntered < "" Then If Not DataEntered Like "093########" Then Proceed = False End If End If Next K If Proceed Then 'Whatever you want to happen Else MsgBox "Something isn't right - etc...", vbOKOnly End If End Sub However it doesn't compare the numbers against each other - I'm working on this. Nick Shinkins "Shetty" wrote: I have a control arrey of 10 text boxes (from 0 to 9) on a form. After user enters data in text boxes, and clicks on commandbutton "GO", I want to validate the data. Validation rules: 1. data must be numaric from 0 to 9 only 2. each number entered must be unique, duplicate numbers not allowed. 3. each number must start with 093 4. each number must have 11 digits, no more no less. If any rule is violated, I want to warn the user and want them to re-enter the data. The macro should proceed only when above criteria is meet with. Second problem is: I want to process only non blank textboxes. I can loop thru it but how can I ignore blank text boxes? Thanks for any help. Regards, Shetty |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unique data in control arrey of textboxes
NIck,
Thanks for your reply. 1. I am unable to write the code for the uniqueness of all the strings. I mean all the ten strings (or numbers entered in textboxes must be unique Duplicates are not allowed. 2. Is it right way to use control arrey of 10 textboxes? or I should create 10 saperate textboxes? Thanks again. Regards, Nick Shinkins wrote: Here is a very rough version of what you want... Sub Trial() Dim DataEntered As String Dim Proceed As Boolean Proceed = True For K = 0 To 9 DataEntered = ControlNameK.Value If DataEntered < "" Then If Not DataEntered Like "093########" Then Proceed = False End If End If Next K If Proceed Then 'Whatever you want to happen Else MsgBox "Something isn't right - etc...", vbOKOnly End If End Sub However it doesn't compare the numbers against each other - I'm working on this. Nick Shinkins "Shetty" wrote: I have a control arrey of 10 text boxes (from 0 to 9) on a form. After user enters data in text boxes, and clicks on commandbutton "GO", I want to validate the data. Validation rules: 1. data must be numaric from 0 to 9 only 2. each number entered must be unique, duplicate numbers not allowed. 3. each number must start with 093 4. each number must have 11 digits, no more no less. If any rule is violated, I want to warn the user and want them to re-enter the data. The macro should proceed only when above criteria is meet with. Second problem is: I want to process only non blank textboxes. I can loop thru it but how can I ignore blank text boxes? Thanks for any help. Regards, Shetty |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Arrey Formula | Excel Worksheet Functions | |||
Filer for unique records and return all column data for unique rec | Excel Discussion (Misc queries) | |||
Need help w/ userform with 12 textboxes with data going into colum | Excel Discussion (Misc queries) | |||
control textboxes keep changing size | Excel Discussion (Misc queries) | |||
Unique data in control arrey of textboxes | Excel Programming |