Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Group controls


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Group controls

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Group controls


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Group controls

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
Is it possible to group parts with controls? [email protected] Excel Discussion (Misc queries) 4 October 12th 05 11:10 PM
Event procedures for controls added with Controls.Add John Austin[_4_] Excel Programming 1 March 9th 05 03:31 PM
Group Controls Jack D[_2_] Excel Programming 1 January 20th 04 03:27 AM
group name for form controls Edwin Merced Excel Programming 2 November 29th 03 12:45 AM


All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"