Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default Dynamic userform help - Data Validation

I have a dynamic userform that has a multipage on it. Each page of the
multipage gets populated with labels, textboxes and comboboxes. I need to
know how to go about doing some data validation. ie. some boxes will have
just numbers, just text, text and numbers or date. I need to set an input
mask for each textbox or combo, and its not easy because the names of the
controls will change each time depending on options selected. I have set the
tag values for each as well so maybe i can use those for something. I dont
know of an event that fires when any textbox changes. Any help would be great
thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Dynamic userform help - Data Validation

there's CHANGE as well as key press, key down and so on
double click the text box and it will take you to the default event. th
elist where you see 'change' will show what elese is available.

"James" wrote:

I have a dynamic userform that has a multipage on it. Each page of the
multipage gets populated with labels, textboxes and comboboxes. I need to
know how to go about doing some data validation. ie. some boxes will have
just numbers, just text, text and numbers or date. I need to set an input
mask for each textbox or combo, and its not easy because the names of the
controls will change each time depending on options selected. I have set the
tag values for each as well so maybe i can use those for something. I dont
know of an event that fires when any textbox changes. Any help would be great
thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default Dynamic userform help - Data Validation

thanks for the reply but that is what i was trying to explain. it is a
dynamic userform, therefore there is just a form with 8 pages on a multipage
control. No textboxes or comboboxes. they get populated later based on
selections.

does anyone know how to write code that "writes code" so on creation of a
new texbox or combobox it places:

Sub Textbox(i)_Change()
validation_function
end sub

Would that work? Im not sure?


"Patrick Molloy" wrote:

there's CHANGE as well as key press, key down and so on
double click the text box and it will take you to the default event. th
elist where you see 'change' will show what elese is available.

"James" wrote:

I have a dynamic userform that has a multipage on it. Each page of the
multipage gets populated with labels, textboxes and comboboxes. I need to
know how to go about doing some data validation. ie. some boxes will have
just numbers, just text, text and numbers or date. I need to set an input
mask for each textbox or combo, and its not easy because the names of the
controls will change each time depending on options selected. I have set the
tag values for each as well so maybe i can use those for something. I dont
know of an event that fires when any textbox changes. Any help would be great
thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Dynamic userform help - Data Validation

here's a simple example to get you going....code is behind the userform...

thios simply creates 10 text boxes on the form. you vcan easily amend for
whetever you need ....

Option Explicit
Dim WithEvents ctTextBox As clsControl
Public ctrl As Control
Private Sub UserForm_Initialize()
Set ctTextBox = New clsControl
Add_Controls "Forms.Textbox.1", 10
End Sub
Private Sub Add_Controls(sType As String, count As Long)
Dim index As Long
Dim TP As Long
TP = 10
For index = 1 To count
Set ctrl = Me.Controls.Add("Forms.Textbox.1")
With ctrl
.Top = TP + ctrl.Height
.Left = 25
.text = "TextBox " & index
End With

ctrl.Top = TP
TP = TP + ctrl.Height

Next
End Sub



"James" wrote:

thanks for the reply but that is what i was trying to explain. it is a
dynamic userform, therefore there is just a form with 8 pages on a multipage
control. No textboxes or comboboxes. they get populated later based on
selections.

does anyone know how to write code that "writes code" so on creation of a
new texbox or combobox it places:

Sub Textbox(i)_Change()
validation_function
end sub

Would that work? Im not sure?


"Patrick Molloy" wrote:

there's CHANGE as well as key press, key down and so on
double click the text box and it will take you to the default event. th
elist where you see 'change' will show what elese is available.

"James" wrote:

I have a dynamic userform that has a multipage on it. Each page of the
multipage gets populated with labels, textboxes and comboboxes. I need to
know how to go about doing some data validation. ie. some boxes will have
just numbers, just text, text and numbers or date. I need to set an input
mask for each textbox or combo, and its not easy because the names of the
controls will change each time depending on options selected. I have set the
tag values for each as well so maybe i can use those for something. I dont
know of an event that fires when any textbox changes. Any help would be great
thanks.

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
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Programming 0 November 7th 06 12:54 PM
Dynamic Data Validation Alex Excel Programming 2 June 15th 05 11:28 AM
Data Validation - Dynamic Steph[_3_] Excel Programming 1 March 21st 05 06:34 PM


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

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"