Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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
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
Arrey Formula Eva Excel Worksheet Functions 2 February 15th 10 05:59 PM
Filer for unique records and return all column data for unique rec bseeley Excel Discussion (Misc queries) 1 September 12th 09 12:17 AM
Need help w/ userform with 12 textboxes with data going into colum cj2k2k Excel Discussion (Misc queries) 1 June 13th 07 02:38 PM
control textboxes keep changing size Jimbolina Excel Discussion (Misc queries) 1 November 8th 05 05:49 AM
Unique data in control arrey of textboxes Shetty Excel Programming 0 December 22nd 04 12:34 PM


All times are GMT +1. The time now is 05:45 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"