Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default renaming multiple buttons

Hi all,

I have a worksheet with lots of OptionButtons which are named from
OptionButtion1 through to OptionButton266. Unfortunately I need to rename
to GW2opt1, etc - Is there anyway I can do this without having to change
each name individually? I've tried some VB but to no avail......

Tia


  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default renaming multiple buttons

Hi Green Bean,

If the option buttons are from the Forms toolbar, try:

'=============
Public Sub Tester()
Dim OP As OptionButton

For Each OP In ActiveSheet.OptionButtons
With OP
.Name = Replace(.Name, "OptionButton", "GW2opt")
End With
Next OP
End Sub
'<<=============


If, however, the option buttons are from the Controls Toolbox, try:

'=============
Public Sub Tester2()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "OptionButton", "GW2opt")
End With
Next OleObj
End Sub
'<<=============


---
Regards,
Norman



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

I have a worksheet with lots of OptionButtons which are named from
OptionButtion1 through to OptionButton266. Unfortunately I need to rename
to GW2opt1, etc - Is there anyway I can do this without having to change
each name individually? I've tried some VB but to no avail......

Tia



  #3   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default renaming multiple buttons

The second one worked perfectly - many thanks for help and saving me a
tedious task...


"Norman Jones" wrote in message
...
Hi Green Bean,

If the option buttons are from the Forms toolbar, try:

'=============
Public Sub Tester()
Dim OP As OptionButton

For Each OP In ActiveSheet.OptionButtons
With OP
.Name = Replace(.Name, "OptionButton", "GW2opt")
End With
Next OP
End Sub
'<<=============


If, however, the option buttons are from the Controls Toolbox, try:

'=============
Public Sub Tester2()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "OptionButton", "GW2opt")
End With
Next OleObj
End Sub
'<<=============


---
Regards,
Norman



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

I have a worksheet with lots of OptionButtons which are named from
OptionButtion1 through to OptionButton266. Unfortunately I need to
rename
to GW2opt1, etc - Is there anyway I can do this without having to change
each name individually? I've tried some VB but to no avail......

Tia





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
Deleting multiple Macro buttons Ant Excel Discussion (Misc queries) 3 June 13th 06 02:34 AM
Excel pivot chart - Scales on multiple field buttons Ali Charts and Charting in Excel 0 May 4th 06 01:22 PM
Multiple fill color buttons susielotus Excel Discussion (Misc queries) 1 February 5th 06 04:04 PM
Renaming multiple sheets Mark T Excel Worksheet Functions 14 July 16th 05 02:22 AM
Maintain cell links when renaming directory containing multiple f Excel52 Excel Worksheet Functions 0 April 28th 05 10:54 PM


All times are GMT +1. The time now is 07:14 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"