How to put an ampersand in a header/footer in Excel?

excel, vba

Solution

It turns out to be a super simple solution ...

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

Same in VBA String for: hello & world

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

Problem

I am working on a header which needs an ampersand to separate two words. `Hello & World` But it ignores the `&` because most of the built in functions evaluate it to a value ie. `Page &[Page] of &[Pages]` => `Page 1 of 3` `&[Time]` or `&T` => `10:26` So, how to escape an ampersand in a header?

Original source