[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Rename selected (highlighted) sheet with cell contents of sheets in cell A1

al

12/15/2006 7:58:00 AM

How can i modify macro below - to make it work for only sheets i've
selected (group) - instead of all sheets in active workbook.

Sub RenameWS()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
ws.Name = Range("A1").Value
Next
End Sub

Thxs

2 Answers

Jericho

12/15/2006 8:33:00 AM

0

Sub RenameWS()
Dim ws As Worksheet
For Each ws In ActiveWindow.SelectedSheets
ws.Activate
ws.Name = Range("A1").Value
Next
End Sub

Cheers,
Joerg Mochikun


<transferxxx@gmail.com> wrote in message
news:1166169505.200005.160680@j72g2000cwa.googlegroups.com...
> How can i modify macro below - to make it work for only sheets i've
> selected (group) - instead of all sheets in active workbook.
>
> Sub RenameWS()
> Dim ws As Worksheet
> For Each ws In ActiveWorkbook.Worksheets
> ws.Activate
> ws.Name = Range("A1").Value
> Next
> End Sub
>
> Thxs
>


al

12/15/2006 8:42:00 AM

0

thxs!!


Joerg wrote:
> Sub RenameWS()
> Dim ws As Worksheet
> For Each ws In ActiveWindow.SelectedSheets
> ws.Activate
> ws.Name = Range("A1").Value
> Next
> End Sub
>
> Cheers,
> Joerg Mochikun
>
>
> <transferxxx@gmail.com> wrote in message
> news:1166169505.200005.160680@j72g2000cwa.googlegroups.com...
> > How can i modify macro below - to make it work for only sheets i've
> > selected (group) - instead of all sheets in active workbook.
> >
> > Sub RenameWS()
> > Dim ws As Worksheet
> > For Each ws In ActiveWorkbook.Worksheets
> > ws.Activate
> > ws.Name = Range("A1").Value
> > Next
> > End Sub
> >
> > Thxs
> >