Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cycle through controls with similar names
I have made a user form which allows the user to select a
number of groups all with the same parameters. Hence, I have 6 of every control used for selection (text boxes and combo boxes) and I have named the txt1, txt2, through to txt6. I want to be able to do the same thing to each control within a loop like you could do if these were named ranges (e.g. Range("txt" & grp)). Is there a way to do this? I had also thought of directly linking each text box to a cell using the ControlSource property. The problem is that I want to be able to move these ranges if I need to so that I can add more options later. I have found that if you enter an address then this does not get moved if you move the cell. I tried linking them to a named range but this also seems to continue linking to the original cell rather than moving to the range where the name is now. Can somebody point me in the direction of some useful instructions on either cycling through control names or linking directly to cells or towards a more efficient method. Thanks! Tim |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cycle through controls with similar names
For i = 1 To 6 Me.Controls("txt" & i).Text = i Next i -- HTH RP (remove nothere from the email address if mailing direct) "Tim Archer" wrote in message ... I have made a user form which allows the user to select a number of groups all with the same parameters. Hence, I have 6 of every control used for selection (text boxes and combo boxes) and I have named the txt1, txt2, through to txt6. I want to be able to do the same thing to each control within a loop like you could do if these were named ranges (e.g. Range("txt" & grp)). Is there a way to do this? I had also thought of directly linking each text box to a cell using the ControlSource property. The problem is that I want to be able to move these ranges if I need to so that I can add more options later. I have found that if you enter an address then this does not get moved if you move the cell. I tried linking them to a named range but this also seems to continue linking to the original cell rather than moving to the range where the name is now. Can somebody point me in the direction of some useful instructions on either cycling through control names or linking directly to cells or towards a more efficient method. Thanks! Tim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
similar names - two spreadsheets | Excel Worksheet Functions | |||
See names of controls | Excel Discussion (Misc queries) | |||
SIMILAR NAMES IN A TABLE | Excel Discussion (Misc queries) | |||
How to cycle through a series of similar objects with a for-next loop? | Excel Programming | |||
Cycle trhough a list of names | Excel Programming |