简体   繁体   中英

Add name and date to new tab

I want to create a new tab, then give the tab a name and the current date. like: Group Bene 8/27/2019

I can get the tab to be named as a date, or as Group Bene, but I cannot get both on the same tab.

Sub Refresh()

myWorksheetName = Format(Now, "mmmm_dd_yyyy")

'add new tab
Sheets.Add.Name = myWorksheetName

The above gives me the tab with the dat. I've tried:

myWorksheetName = Format(Now, "mmmm_dd_yyyy Group Bene")

myWorksheetName = Format(Now, "mmmm_dd_yyyy" + "Group Bene")

myWorksheetName = Format(Now, "mmmm_dd_yyyy"&"Group Bene")

I get errors.

Simple concatenation here, with the " Group Bene" (including a space) outside the Format :

myWorksheetName = Format(Now, "mmm_dd_yyyy") & " Group Bene"

returns

Aug_27_2019 Group Bene

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM