How to fix my bad pool header error?

Excel header format

  • QUESTION: I'm trying to format a header font size. The value of header is come from one of my cell. I'm using the following code With ActiveSheet.PageSetup .CenterHeader = "%265" %26 ActiveSheet.Range("A9:B9").Value .RightHeader = "%265" %26 ActiveSheet.Range("G9:I9").Value End With But always give me a type mismatch error. I try separate them but all I get either no change of font or other stuff. Please help ANSWER: The code below will create put the follow formatted text in the header. Some Bold Courier New Size 10 Text Worksheets("Sheet2").PageSetup.LeftHeader = _ "Some&B&""Courier New""&10 Bold Courier New Size 10&B&""Arial"" Text" Note that since the font name must be enclosed in quotes in the header string itself, you must use two double quotes in VBA. ---------- FOLLOW-UP ---------- QUESTION: Thanks, I can get the header to change font size when it is fix text. But I need the header information to be reference to a cell in the workbook that will change on the fly.

  • Answer:

    Try assigning the text in those cells to a variable, like: Dim Header_Cells as Range Dim Header_Text as String Dim H as Range Set Header_Cells = ActiveSheet.Range("A9:B9") For Each H in Header_Cells Header_Text = H %26 vbcr %26 Header_Text Next H and use the method I suggested using the variable Header_Text. Also, your error is coming from the fact that you are trying reference more than one cell in the header. If this does not work then I suspect that it may not be able to be done.

Miningco.com Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.