View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Change multiple object group name

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName & "4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt is
there a way to change group names e.g. change group 1a to 1a4 but using a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply,

Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub