How to put ampersand in header / footer in Excel?

I am working on a headline that needs an ampersand to separate two words.

Hello & World

But it ignores & , because most built-in functions evaluate it to a value, i.e.

Page &[Page] of &[Pages] => Page 1 of 3

&[Time] or &T => 10:26

So how to avoid the ampersand in the header?

+7
vba excel-vba excel
source share
1 answer

Turns out this is a super easy solution ...

Double && to escape from Excel, trying to evaluate the built-in function.

Same thing in VBA String for: hello and world

Sheet1.PageSetup.CenterHeader = "hello && world!"

+7
source share

All Articles