Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() How can I group some textboxes and refer each element of group? -- stefantem ------------------------------------------------------------------------ stefantem's Profile: http://www.excelforum.com/member.php...o&userid=13594 View this thread: http://www.excelforum.com/showthread...hreadid=500081 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the macro recorder to get syntax how to group your textboxes (edit the
recorded macro of unnecessary "Selects" etc). Then to refer to grouped items within the group- Sub test() Dim gpItem As Object Set shp = ActiveSheet.Shapes("Group 3") If shp.Type = msoGroup Then For Each gpItem In shp.GroupItems 'Debug.Print gpItem.Name Msgbox gpItem.Name Next End If End Sub If you have sub-groups within a group would need a recursive type function. Regards, Peter T "stefantem" wrote in message ... How can I group some textboxes and refer each element of group? -- stefantem ------------------------------------------------------------------------ stefantem's Profile: http://www.excelforum.com/member.php...o&userid=13594 View this thread: http://www.excelforum.com/showthread...hreadid=500081 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The textboxes are in an userform. dim group1 as New Collection group1.Add Item.... then refer the elements How can I use this? -- stefantem ------------------------------------------------------------------------ stefantem's Profile: http://www.excelforum.com/member.php...o&userid=13594 View this thread: http://www.excelforum.com/showthread...hreadid=500081 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
An example:
Private Sub CommandButton1_Click() Dim group As New Collection For Each ctrl In Me.Controls If TypeOf ctrl Is MSForms.TextBox Then group.Add ctrl, ctrl.Name End If Next For i = 1 To group.Count j = Int(Rnd() * group.Count + 1) group(j).Value = group(i).Name Next msgbox Group("Textbox3").Value End Sub -- Regards, Tom Ogilvy "stefantem" wrote in message ... The textboxes are in an userform. dim group1 as New Collection group1.Add Item.... then refer the elements How can I use this? -- stefantem ------------------------------------------------------------------------ stefantem's Profile: http://www.excelforum.com/member.php...o&userid=13594 View this thread: http://www.excelforum.com/showthread...hreadid=500081 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ActiveX Controls vs Form Controls | Excel Discussion (Misc queries) | |||
Is it possible to group parts with controls? | Excel Discussion (Misc queries) | |||
Event procedures for controls added with Controls.Add | Excel Programming | |||
Group Controls | Excel Programming | |||
group name for form controls | Excel Programming |