Programming a tab name into a Header String

  • Thread starter Thread starter DoctorV
  • Start date Start date
D

DoctorV

I have a function that creates unique tabs based on a column.
programmatically set the Center Header to a string listed below.
also need it to display the tab or worksheet name, but whenever I ad
[tab] to the string below it bombs out. How can I get this to displa
the worksheet name in the header as well

Current
CenterHeader = "Insurance Operations Six Month Schedule as of "
Sheets("MainForm").Range("A9").Value

Like To Have
CenterHeader = "Insurance Operations Six Month Schedule as of "
Sheets("MainForm").Range("A9").Value + for [tab] (ie the Workshee
Name
 
I recorded a macro when I did it manually and got this:

..CenterHeader = "asdf adsf a &A"

It sure looks like &A is the symbol for the Tab name (but that isn't what shows
in the user interface).

So maybe, this'll work for you:

.CenterHeader = "Insurance Operations Six Month Schedule as of " _
& Sheets("MainForm").Range("A9").Value & " for &A"

ps. VBA is very forgiving, but + is usually meant for adding numbers. & is
used to concatenate text.

pps. Record a macro if you ever decide to change the font size in this title.
You'll see how excel embeds the font size (and font, too) right in the string.



DoctorV < said:
I have a function that creates unique tabs based on a column. I
programmatically set the Center Header to a string listed below. I
also need it to display the tab or worksheet name, but whenever I add
[tab] to the string below it bombs out. How can I get this to display
the worksheet name in the header as well

Current
CenterHeader = "Insurance Operations Six Month Schedule as of " &
Sheets("MainForm").Range("A9").Value

Like To Have
CenterHeader = "Insurance Operations Six Month Schedule as of " &
Sheets("MainForm").Range("A9").Value + for [tab] (ie the Worksheet
Name)
 
Back
Top