简体   繁体   中英

Excel VBA change footer font and font size

The following Excel VBA code automatically changes the footer when a cell value changes, but Excel also changes the font and size. I am trying to keep the font Arial and font size 10. How do I do that? Thanks!

Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    If Target.Address = "$E$4" Then
        ActiveSheet.PageSetup.LeftFooter = Range("$G$4").Value
    End If
End Sub

Try this:

ActiveSheet.PageSetup.LeftFooter = "&""Arial""&10" & Range("$G$4").Value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM