![]() |
Renaming Worksheet
Hello all,
I have the following problem which I'd like to solve with a macro. Is it possible to run a macro that renames the worksheet with the text I put in this worksheet in cell B1, e.g.? I hope there is a solution. Thanx for your help. Kind regards, Noepie |
Renaming Worksheet
here are 2 examples, one using activesheet and one using the index number, which
is the first sheet in this case: Sub rename_sheet() With Worksheets(1) ..Name = .Range("B1").Value End With End Sub Sub rename_sheet() With ActiveSheet ..Name = .Range("B1").Value End With End Sub -- Gary "Noepie" wrote in message ... Hello all, I have the following problem which I'd like to solve with a macro. Is it possible to run a macro that renames the worksheet with the text I put in this worksheet in cell B1, e.g.? I hope there is a solution. Thanx for your help. Kind regards, Noepie |
Renaming Worksheet
Hello Noepie
This is an event code, so it has to be copied into the codesheet for the desired sheet. Right click on the desired sheet tab and select "View Code". Paste the code below. Private Sub Worksheet_Change(ByVal Target As Range) If Target = Range("B1") Then If Target.Value < "" Then ActiveSheet.Name = Target.Value End If End If End Sub Regards, Per "Noepie" skrev i meddelelsen ... Hello all, I have the following problem which I'd like to solve with a macro. Is it possible to run a macro that renames the worksheet with the text I put in this worksheet in cell B1, e.g.? I hope there is a solution. Thanx for your help. Kind regards, Noepie |
Renaming Worksheet
Dear Per / Gary,
Both ways give the desired result, so thanx for helping me out. Kind regards, Noepie "Per Jessen" wrote: Hello Noepie This is an event code, so it has to be copied into the codesheet for the desired sheet. Right click on the desired sheet tab and select "View Code". Paste the code below. Private Sub Worksheet_Change(ByVal Target As Range) If Target = Range("B1") Then If Target.Value < "" Then ActiveSheet.Name = Target.Value End If End If End Sub Regards, Per "Noepie" skrev i meddelelsen ... Hello all, I have the following problem which I'd like to solve with a macro. Is it possible to run a macro that renames the worksheet with the text I put in this worksheet in cell B1, e.g.? I hope there is a solution. Thanx for your help. Kind regards, Noepie |
All times are GMT +1. The time now is 11:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com