Rename a worksheet using a formula

Downes51

New Member
Joined
Mar 30, 2016
Messages
26
Hello.

I want to rename my worksheet with today's date preceded by the letters LB (space).

I've been tinkering with the syntax of this statement for a while and I can't get it to work.



ActiveSheet.Name = "=""LB ""&TEXT(TODAY(),""YYYY-MM-DD"")"


If I place the above formula in a cell it works just fine.
Any suggestions?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Code:
  On Error Resume Next
  ActiveSheet.Name = "LB " & Format(Date, "YYYY-MM-DD")
You should also be able to do it without the concatenation this way...

ActiveSheet.Name = Format(Date, "LB YYYY-MM-DD")

While I do not think the Format function will have any trouble with the LB embedded inside the format pattern text string (like the TEXT function on the worksheet does)... if you get a strange result where the LB is supposed to go, then precede the letter or letters that are not printing out correctly with a backslash (you can do this with the TEXT function in a worksheet formula too by the way). Let's say in your locale, the B did not print correctly, then put a backslash in front of it, like this...

ActiveSheet.Name = Format(Date, "L\B YYYY-MM-DD")

Same for the letter L if that does not print correctly,
 
Upvote 0

Forum statistics

Threads
1,214,891
Messages
6,122,105
Members
449,066
Latest member
Andyg666

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