Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
data validation invalid in dynamic validation list | Excel Discussion (Misc queries) | |||
data validation invalid in dynamic validation list | Excel Worksheet Functions | |||
data validation invalid in dynamic validation list | Excel Programming | |||
Dynamic Data Validation | Excel Programming | |||
Data Validation - Dynamic | Excel Programming |