Rename sheet based on cell in another sheet

xbunsenx

New Member
Joined
May 26, 2016
Messages
10
I am trying to rename a tab based on a cell value in another sheet. I would like the tab to be renamed after the cell is changed. I have searched and cannot find a solution. A1 is on Sheet2 and I want it to rename Sheet3. Any help is appreciated. This is what I tried, but obviously it does not work.

Private Sub Worksheet_change(ByVal Target As Range)
If Target.Address = Range("A1") Then
Sheet("Sheet3").Name = Range("A1").Value
End If
End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I could not get anything to work that was posted. I have to admit that I am not fluent in VBA code enough to know what is not working. I do want this process to work automatically and not in a macro. Thank you for any assistance.
 
Upvote 0
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Put this script in Sheet(2)

Code:
Private Sub Worksheet_change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
On Error GoTo M
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Sheets(3).Name = Target.Value
End If
Exit Sub
M:
MsgBox "You entered an inproper sheet name or  " & vbNewLine & " Sheet name already exist"
End Sub
 
Last edited:
Upvote 0
My Answer,

It worked perfectly. I just had to add the ability to edit objects because the worksheets I am renaming are protected to prevent someone from accidentally altering a formula. Thank you for your help. I have learned something new.
 
Upvote 0
Glad I was able to help you. Come back here to Mr. Excel next time you need additional assistance.
My Answer,

It worked perfectly. I just had to add the ability to edit objects because the worksheets I am renaming are protected to prevent someone from accidentally altering a formula. Thank you for your help. I have learned something new.
 
Upvote 0
Is it possible to do this same function with multiple worksheets and different cells?
 
Upvote 0
Is it possible to do this same function with multiple worksheets and different cells?
This is a very old posting from 2017
I suggest you make a new posting and be very specific
Give exact sheet names. Just be very specific with the details we need.
That stops us from having to come back and ask questions. I will see your new posting and try to help
 
Upvote 0
I made a post

 
Upvote 0

Forum statistics

Threads
1,215,387
Messages
6,124,633
Members
449,177
Latest member
Sousanna Aristiadou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top