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
Related Q & A:
- How to get correct URL in HTTP header?Best solution by Stack Overflow
- How to add a column header to the dynamic table?Best solution by stackoverflow.com
- How To Sort a GridView Column When a Header Is Clicked?Best solution by Stack Overflow
- What is a C header file?Best solution by Yahoo! Answers
- How to covert csv file to excel and back excel file to csv in python?Best solution by completecampaigns.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.