Can logic be added to footer to add a name from a worksheet?

G

Guest

Is it possible to set up a footer in Excel with logic that will add a name
from a cell in one of the worksheets and the word "Confidential"? Thanks in
advance, Carl
 
G

Gord Dibben

Sub CellInFooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("A1").Value & "Confidential"
End With
End Sub


Gord Dibben MS Excel MVP
 
G

Guest

Thanks. Worked like a charm!

Gord Dibben said:
Sub CellInFooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("A1").Value & "Confidential"
End With
End Sub


Gord Dibben MS Excel MVP
 
G

Guest

Your code worked great but it leaves the font size at default, 10. Would you
mind providing the code to set the font size at 6 please? Thanks again in
advance, Carl
 
G

Gord Dibben

Sub CellInFooter()
With ActiveSheet
.PageSetup.CenterFooter = "&""Arial,Regular""&6" & Range("A1").Value
End With
End Sub


Gord
 
G

Guest

Thanks again, Gord. It worked great using the example you showed but, if I
can impose on your patience one more time, I ran into problems when I tried
to use it before the insertion of the date (it changes the font to HUGE).
Thanks again in advance, Carl

Sub CellInFooter()
With ActiveSheet
.PageSetup.LeftFooter = "&""Arial,Regular""&6" & Format(Now(),
"mm/dd/yy") & ", CONFIDENTIAL " & Sheets("Home").Range("B7").Value
End With
End Sub
 
G

Gord Dibben

You need an extra space between the fontsize(6) and the ampersand before the
date.

Your current code runs the 6 into the date and winds up 610/20/07 so Excel tries
to re-size the font to 610 size. 409 is largest so that's what you get.

Sub CellInFooter()
With ActiveSheet
.PageSetup.LeftFooter = "&""Arial,Regular""&6 " & Format(Now, _
"mm/dd/yy") & ", CONFIDENTIAL " & Sheets("Day").Range("B7").Value
End With
End Sub


Gord
 
G

Gord Dibben

Please note I changed "Home" to "Day" for testing.

Don't forget to change back like I did<g>

Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top