Naming Worksheets with a Variable without using a cell

Shiseiji

Board Regular
Joined
Oct 23, 2009
Messages
214
Office Version
  1. 2019
Platform
  1. Windows
I've been working with naming worksheets, and all the code I've found uses a cell then names the worksheet the cell contents. It got me wondering and searching to see if it's possible to bypass using a cell. I don't know if it's impossible or I'm not searching with the correct terms. Is there a way to bypass using a cell?

This is what I'm using now. The last column +1 is simply a known empty cell.
Code:
Cells(1, LastCol).Offset(0, 1).Name = "cel_CDate1"
Range("cel_CDate1").Offset(0, 1).Name = "cel_CDate2"
    With Range("cel_CDate2")
        .NumberFormat = "mm-dd-yyyy"
        .Formula = "=""User Accounts "" & TEXT(TODAY(),""mm-dd-yy"")"
        .Copy
        .PasteSpecial xlPasteValues
    End With
    '
    Sheet1.Name = Range("cel_CDate2").Value
    ws.Range("cel_CDate2").Clear
    wb.Names("cel_CDate2").Delete
In other words, is it possible to write code where the Sheet1.Name = Range("cel_CDate2").Value is replaced with "something" like
Sheet1.Name = ?????
.Formula = "=""User Accounts "" & TEXT(TODAY(),""mm-dd-yy"")"
and bypassing the need to use a cell?

Thanks for helping me to learn.

Ron
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Like
Code:
Sheet1.Name = "User Accounts " & Format(Date, "mm-dd-yy")
 
Upvote 0
Solution
Oh my . . . :banghead: One day I hope I'll get it figured out why Format(Date, "mm-dd-yy") is the same as TEXT(TODAY(),""mm-dd-yy"")

Appreciate the help!

Thanks

Ron
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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