Change Group Name

Zanatos

Board Regular
Joined
May 18, 2007
Messages
65
Self Explanitory
I have a big group of items connected to a commandbutton used through VBA, anyway the name is something generic like Group1198 and I have so many groups I want to make it so you know which group it is refering to. I have been looking for an option to do this but have not seen it, is it possible? If so, how?

Thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I have a large group of items (picture and about 20+ text boxes) and it was automatically named "Group 555". I have this group # associated with a macro, and it works the way I want.

The problem is everytime I ungroup my group of items to make changes and regroup, the name "Group 555" gets changed to a new generic name, such as "Group 777", and the macro no longer recognize it.

What I need to know if there is way to change this to a non-generic name, such as "Model" and keep it like that even when changes are made, so that it always references the macro.

Normally this wouldn't be a problem, but multiple people will be maintaining this spreadsheet and won't know how to fix the macro when they edit the group.

I hope this makes more sence.


Thanks!
 
Upvote 0
I may not be able to assist you with this, but is this the only group on the page or is there more than 1 group?
 
Upvote 0
hmmm. You may be able to work with something like this:

Code:
Sub Macro1()
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
    If sh.Type = msoGroup Then MsgBox "Found"
Next sh
End Sub
If they always intersect a certain range within the sheet you could use a case select for which one to perform the macro one:

Code:
Sub Macro1()
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
    If sh.Type = msoGroup Then
        If Not Intersect(sh.TopLeftCell, Range("A1:D5")) Is Nothing Then
            MsgBox "Found"
        ElseIf Not Intersect(sh.TopLeftCell, Range("F1:I5")) Is Nothing Then
            MsgBox "Found2"
        End If
    End If
Next sh
End Sub
This is just a very simple approach, but it should be able to get the job done it you tweak it to your needs. Replace the messageboxes with calling the macro needed. Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top