Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Auto Grouping of Option Buttons

I have a worksheet that has a dozen option button groups. This sheet is to be
copied/pasted in the same excel file more than 100 times. Is there a way to
have the option button groups change there groupname automatically, so that I
dont end up doing it manually 1100 times.

Thanks,
Rafat Inayat Elahi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Auto Grouping of Option Buttons

Perhaps by using a macro to loop through your controls and manipulate the
required properties.

--
Regards,
Tom Ogilvy


"Rafat" wrote:

I have a worksheet that has a dozen option button groups. This sheet is to be
copied/pasted in the same excel file more than 100 times. Is there a way to
have the option button groups change there groupname automatically, so that I
dont end up doing it manually 1100 times.

Thanks,
Rafat Inayat Elahi

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Auto Grouping of Option Buttons

Is it possible if you could provide a link or some insight as to how to
accomplish that?

Thanks,
Rafat I Elahi



"Tom Ogilvy" wrote:

Perhaps by using a macro to loop through your controls and manipulate the
required properties.

--
Regards,
Tom Ogilvy


"Rafat" wrote:

I have a worksheet that has a dozen option button groups. This sheet is to be
copied/pasted in the same excel file more than 100 times. Is there a way to
have the option button groups change there groupname automatically, so that I
dont end up doing it manually 1100 times.

Thanks,
Rafat Inayat Elahi

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Auto Grouping of Option Buttons

Sub ListData()
Dim obj As OLEObject
Dim sh As Worksheet
Dim ob As MSforms.OptionButton
Dim sh1 As Worksheet
Set sh1 = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
rw = 2
sh1.Cells(1, 1) = "Sheet"
sh1.Cells(1, 2) = "Object"
sh1.Cells(1, 3) = "GroupName"
For Each sh In Worksheets

If sh.Name < sh1.Name Then
For Each obj In sh.OLEObjects
If TypeOf obj.Object Is MSforms.OptionButton Then
Set ob = obj.Object
sh1.Cells(rw, 1).Value = sh.Name
sh1.Cells(rw, 2).Value = ob.Name
sh1.Cells(rw, 3).Value = ob.GroupName
rw = rw + 1
End If
Next
End If
Next
End Sub

this gives you a sample of the structure of code you would need. It just
lists all the option buttons and their group names - it should be a short
step from there to assign new group names to them.

--
Regards,
Tom Ogilvy


"Rafat" wrote:

Is it possible if you could provide a link or some insight as to how to
accomplish that?

Thanks,
Rafat I Elahi



"Tom Ogilvy" wrote:

Perhaps by using a macro to loop through your controls and manipulate the
required properties.

--
Regards,
Tom Ogilvy


"Rafat" wrote:

I have a worksheet that has a dozen option button groups. This sheet is to be
copied/pasted in the same excel file more than 100 times. Is there a way to
have the option button groups change there groupname automatically, so that I
dont end up doing it manually 1100 times.

Thanks,
Rafat Inayat Elahi

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Auto Grouping of Option Buttons

Thank you very much. I really appreciate your effort.
Rafat

"Tom Ogilvy" wrote:

Sub ListData()
Dim obj As OLEObject
Dim sh As Worksheet
Dim ob As MSforms.OptionButton
Dim sh1 As Worksheet
Set sh1 = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
rw = 2
sh1.Cells(1, 1) = "Sheet"
sh1.Cells(1, 2) = "Object"
sh1.Cells(1, 3) = "GroupName"
For Each sh In Worksheets

If sh.Name < sh1.Name Then
For Each obj In sh.OLEObjects
If TypeOf obj.Object Is MSforms.OptionButton Then
Set ob = obj.Object
sh1.Cells(rw, 1).Value = sh.Name
sh1.Cells(rw, 2).Value = ob.Name
sh1.Cells(rw, 3).Value = ob.GroupName
rw = rw + 1
End If
Next
End If
Next
End Sub

this gives you a sample of the structure of code you would need. It just
lists all the option buttons and their group names - it should be a short
step from there to assign new group names to them.

--
Regards,
Tom Ogilvy


"Rafat" wrote:

Is it possible if you could provide a link or some insight as to how to
accomplish that?

Thanks,
Rafat I Elahi



"Tom Ogilvy" wrote:

Perhaps by using a macro to loop through your controls and manipulate the
required properties.

--
Regards,
Tom Ogilvy


"Rafat" wrote:

I have a worksheet that has a dozen option button groups. This sheet is to be
copied/pasted in the same excel file more than 100 times. Is there a way to
have the option button groups change there groupname automatically, so that I
dont end up doing it manually 1100 times.

Thanks,
Rafat Inayat Elahi

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
Grouping Option Buttons ion a Group Box [email protected] New Users to Excel 5 October 15th 06 07:29 PM
Grouping radio option buttons ahmed Excel Programming 1 May 1st 06 11:13 PM
Option buttons: How to get the selected option from a group? naddad Excel Programming 5 December 21st 05 05:09 PM
grouping of option buttons mapi62 Excel Discussion (Misc queries) 0 February 22nd 05 12:19 PM
Grouping Option Buttons m@_ Excel Programming 3 November 5th 03 02:20 AM


All times are GMT +1. The time now is 04:45 AM.

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

About Us

"It's about Microsoft Excel"