Change Sheet Name to Cell Value (Date)

NicoleLF

New Member
Joined
Oct 30, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Im trying to get the name of my sheet to reflect the same date i have in cell E9 on my sheet. (this is the location on all my sheets where the date is reflected) I was trying to use VBA code on the sheet but i cannot get it right. Could someone please help me?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Try this. NOTE, you cannot use invalid characters such as '/' for tab names...so you'll need to ensure your date in E9 is formatted correctly, or format it in VBA.

VBA Code:
Private Sub ChTabName()
    ActiveSheet.Name = Range("E9").Value
End Sub
 
Upvote 0
Example changing format...

VBA Code:
Private Sub ChTabName()
    ActiveSheet.Name = Format(Range("E9").Value, "mm-dd-yyyy")
End Sub
 
Upvote 0
Im trying to get the name of my sheet to reflect the same date i have in cell E9 on my sheet. (this is the location on all my sheets where the date is reflected) I was trying to use VBA code on the sheet but i cannot get it right. Could someone please help me?
Welcome to MrExcel

What format do you want the date to have bearing mind the sheet naming rules?

This code will change the sheet name but needs to be altered depending on how you want the data formatted.

Try it with just random text in cell E9.

Put this cde in the sheet code page.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    With ActiveSheet
        If Target = .Range("E9") Then
            On Error Resume Next
            .Name = .Range("E9").Value
            On Error GoTo 0
        End If
    End With
    
End Sub
 
Upvote 0
Thank you both but neither of those options worked out for my sheet

Date format I have is ddmmmyy

Cell e9 is the date

When I type a date into the cell I would like the sheet name to change to that same date. Currently I manually type them :/
 
Upvote 0
To clarify, you would enter '17oct2023' into E9? If so, give this a try:

VBA Code:
Private Sub worksheet_change(ByVal target As Range)
If Not Intersect(target, Range("E9")) Is Nothing Then
Application.EnableEvents = False
    On Error Resume Next
    ActiveSheet.Name = Format(Range("E9").Value, "ddmmmyy")
Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,838
Members
449,193
Latest member
MikeVol

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