Rename Sheet Based On Cell Value In Excel - VBA Code Included

preview_player
Показать описание
In this video I demonstrate how to automatically rename a sheet (tab) based on the value entered in a cell on that sheet.

Here is the code

If Not Intersect(Target, Range("C2")) Is Nothing Then

If Range("C2") = Empty Then
ActiveSheet.Name = "Client Unspecified-" & ActiveSheet.Index
Else
ActiveSheet.Name = Range("C2")
End If

End If
Рекомендации по теме
Комментарии
Автор

After watching many videos, finally this video has helped. Actually, helped a lot!
Thanks for such a detailed guidance.

naveedyousaf
Автор

Dude, thanks so much for this! I haven't had to write VBA in almost 2 decades, so it was awesome that I found your solution! Discovered that "?" are not valid characters in a sheet name, but that's ok because it's working!

Watched one video...subbed!

sigbauer
Автор

Works like a dream, thanks Chester....

fxtrackr
Автор

Works great! However when I copy a worksheet, I have to recopy and paste the code or I get a name already taken error. Is there a way to copy sheet without having to recopy VBA?

nelsonlaurieann
Автор

What if the name of the sheet I need, i.e., the cell, is in a different sheet? Let's say I want the sheet names (for sheets 2 ...) to be extracted from a list in sheet 1.

eddiesneeh
Автор

Great video, thanks. What if the cell has number as well it doesn't work with formula provides. Do you have a solution for that? Thanks

Zrzmovies
Автор

I like the code, but I have a formula instead of a value, and when update the formula, the sheet name does not change without hitting F2 and enter. I want it to change whenever the formula changes as well. Can you help

corymcgrath
Автор

A few people have asked how to make this happen automatically without changing anything on the sheet that is having its name changed. The response to most people from others has been to make the function volatile. What does this mean? Is the above actually possible to do or do you need to edit something on the worksheet for its name to change?

coachbear
Автор

Thank you, exactly what I was looking for, working great but not with linked cell

DannySalseroDan
Автор

This Videos I have one question i need this code to work in multiple cells at least 2 Is it possible ? Sorry for the stupid question ....

taufan
Автор

Love the tutorial but could you have a VBA tutorial video.

marceljunioregondi
Автор

I want to automatically rename a tab based on a cell if a different sheet. What would the code be for that?

jacobcostello
Автор

Hello, when it comes to renaming excel sheet based on cell value, I have been having issues when the cell is linked. For example if Cell A1 is linked to another cell and if that gets updated the tab will not get updated automatically unless I physically go into cell A1 and hit enter. Is there a way for the tab to get updated automatically without hitting "enter". Please guide. Thank you

joannedemenezes
Автор

Hello Chester, is there a way to do this without VBA?

yokohamazoomer
Автор

Hi, sir, good day, need your favor and assistance, i want to edit the sheet tab name as per cell value in A1 as example if i change the value in A1 as April 6, 2014, it's not working why? Any assistance is of great help.

mauricelee
Автор

Can this same function be performed with dates? Basically, I want cell $A$1 to be a date (formatted as such) and have the tab reflect the date. Thanks.

John-lcfq
Автор

Possible to do this to change a ListObject (Table Name)?

RalphSpeirs
Автор

I have a master worksheet - which i enter my data and the fills out multiple worksheets cell A1 - but then i have to manually need to change the worksheet name - i tried using your code - and if i just use it on its own - it works no issue - but if i try to use the data from another cell (like =WFP!A1 ) - it wont accept the change - but if i physically type it in no issue.. can you please advise?

dominicspagnuolo
Автор

Is there a way to rename an excel file with the contents of a cell? So opening a template would create a new file with the name being the contents of a cell in the new file?

bcso-zz
Автор

hi. i used your code and it works. i use it for stocks. each stock has a sheet, with charts, etc. my workbook is setup so that i have a list of all stocks on sheet 1. On sheet 1, i can enter a number from 1 - 10 and it will list a sector of stocks (tech, financials, etc.). Instead of having 100+ sheets, I have ten and simply change the list depending on the number I enter. Unfortunately your code does not change the sheet name unless I actually go to the cell where the symbol is and change it. It doesn't update when I change the list on sheet 1 (although the cell actually changes to new symbol). Is there a way to address this? Thank you.

erickguz