Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi all, I have a userform that has textboxes that are created and populate dynamically at runtime. i.e.: based on the number of cells found to be populated with data o a spreadsheet, I create a userform with textboxes with value cooresponding to those cells I want to add the ability to double click on these textboxes and hav the value changed to the current date being displayed by a calande control that is also built into my userform. But since don't know how many textboxes are going to be created on given execution of the code, I can't just make the subs that woul normally control click actions. Say there were 2 textboxes being created, I'd then need: Sub Textbox1_dblclick(ByVal Cancel as MSForms.ReturnBoolean) Textbox1 = calendar1 End sub ----------------------------------- Sub Textbox2_dblclick(ByVal Cancel as MSForms.ReturnBoolean) Textbox2 = calendar1 End sub But if I have 5 textboxes, I'd need 5 subs. If 10, then 10. etc. Is there any way to include a variable as part of a sub's name? Like say: Sub Controls("Textbox" & N)_dblClick(ByVal Cancel A MSForms.ReturnBoolean) with the value for N being passed by another procedure during th intial building of the userform -- Ouk ----------------------------------------------------------------------- Ouka's Profile: http://www.excelforum.com/member.php...fo&userid=2398 View this thread: http://www.excelforum.com/showthread.php?threadid=39800 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change Single-Click Functionality? | Excel Discussion (Misc queries) | |||
Scaling a chart that has been dynamically created in vb | Charts and Charting in Excel | |||
Programming double click functionality | Excel Programming | |||
Assign macros to dynamically created form elements | Excel Programming | |||
Program a combobox/dropdownlist to create textboxes dynamically | Excel Programming |