PDA

View Full Version : Solved: Dynamic Custom Header/Footer



qcoleman
09-28-2011, 11:25 AM
Im working on some code and i would like to have and input box pop up and have the user input a value from that value i would like to input the value in the left header. I also would like to adjust the formatting to bold and #12 font Arial.

LH1 = Application.InputBox("Enter the Account Number i.e. 123456789").LeftHeader = LH1

mancubus
09-28-2011, 01:02 PM
LH1 = Application.InputBox("Enter the Account Number i.e. 123456789")

Worksheets("Sheet1").PageSetup.LeftHeader = "&B&""Arial""&12" & LH1

qcoleman
09-28-2011, 01:48 PM
LH1 = Application.InputBox("Enter the Account Number i.e. 123456789")

Worksheets("Sheet1").PageSetup.LeftHeader = "&B&""Arial""&12" & LH1


This works well, but it does not seem to like numerical strings. I tryed typing in a numerical string of numbers in the inputbox and nothing shows up in the left header on the other hand text works perfectly.

mancubus
09-28-2011, 02:32 PM
try:
Worksheets("Sheet1").PageSetup.LeftHeader = "&B&""Arial""&12 " & LH1
added a space after &12


or
Worksheets("Sheet1").PageSetup.LeftHeader = "&""Arial,Bold""&12 " & LH1

qcoleman
09-29-2011, 06:14 AM
Thanks that works Perfectly!

Capungo
10-13-2011, 01:44 PM
Hello Mancubus,

How can we leave one blank line between Left Header and Mid Header? I mean Right and Left Headers will be in the same line, but there will be a blank line between that line and that of the Mid Header.

Thanks in advance...

mancubus
10-13-2011, 11:38 PM
hi capungo.

try this.

With Worksheets("Sheet1").PageSetup
.LeftHeader = "&""Arial,Bold""&12 " & "This is Left Header"
.CenterHeader = "&""Tahoma,Bold""&14 " & vbCrLf & "This is Center Header"
.RightHeader = "&""Verdana,Bold""&12 " & "This is Right Header"
End With

Capungo
10-15-2011, 06:23 AM
Hello Mancubus,

Works very fine. Thank you very much...

mancubus
10-15-2011, 01:00 PM
you're wellcome...