Lukec
Lukec

Reputation: 73

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.

Upvotes: 0

Views: 32

Answers (1)

BigBen
BigBen

Reputation: 50008

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

Upvotes: 1

Related Questions