ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add controls to UserForm (https://www.excelbanter.com/excel-programming/275297-add-controls-userform.html)

Vyyk Drago

Add controls to UserForm
 
Hi,

I'm trying to write a procedure where Excel will
automatically add a certain number of TextBoxes to a
UserForm based on the number of rows in a table. Can
this be done? Also, can a form be created on the fly
using code and how are commands assigned programmatically
to the controls on such a form?

Any advice and insight into this problem will be greatly
appreciated...
Vyyk

Keith Willshaw

Add controls to UserForm
 

"Vyyk Drago" wrote in message
...
Hi,

I'm trying to write a procedure where Excel will
automatically add a certain number of TextBoxes to a
UserForm based on the number of rows in a table. Can
this be done?


Yes but it may not be the best approach

A grid control may work better or you may find it better
to have a form with pre-defined text boxes and on which
you make visible only as many as you require

Also, can a form be created on the fly
using code and how are commands assigned programmatically
to the controls on such a form?


Yes but again I dont recommend it , its far better to
use a grid where you need a table IMHO

Keith



Tom Ogilvy

Add controls to UserForm
 
See John Walkenbach's site for an example:

http://j-walk.com/ss/excel/tips/tip76.htm
Creating a UserForm Programmatically


--
Regards,
Tom Ogilvy

"Vyyk Drago" wrote in message
...
Hi,

I'm trying to write a procedure where Excel will
automatically add a certain number of TextBoxes to a
UserForm based on the number of rows in a table. Can
this be done? Also, can a form be created on the fly
using code and how are commands assigned programmatically
to the controls on such a form?

Any advice and insight into this problem will be greatly
appreciated...
Vyyk




Vyyk Dargo

Add controls to UserForm
 
Thanks! That really helped a lot... :)
Kind regards
Vyyk


-----Original Message-----
Hi,

I'm trying to write a procedure where Excel will
automatically add a certain number of TextBoxes to a
UserForm based on the number of rows in a table. Can
this be done? Also, can a form be created on the fly
using code and how are commands assigned

programmatically
to the controls on such a form?

Any advice and insight into this problem will be greatly
appreciated...
Vyyk
.



All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com