ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rename selected (highlighted) sheet with cell contents of sheets in cell A1 (https://www.excelbanter.com/excel-programming/379487-rename-selected-highlighted-sheet-cell-contents-sheets-cell-a1.html)

[email protected]

Rename selected (highlighted) sheet with cell contents of sheets in cell A1
 
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


Joerg

Rename selected (highlighted) sheet with cell contents of sheets in cell A1
 
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


wrote in message
oups.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




[email protected]

Rename selected (highlighted) sheet with cell contents of sheets in cell A1
 
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


wrote in message
oups.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




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com