
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = "" '页眉左设置为:空
.CenterHeader = "&F" '页眉中设置为:文件名
.RightHeader = "" '页眉右设置为:空
.LeftFooter = "&B 机密 &B" '页脚左设置为:加粗的 机密两个字
.CenterFooter = "&D" '页脚中设置为:当前日期
.RightFooter = " 第 &P 页" '页脚右设置为:页码
End With
Application.PrintCommunication = True
End Sub
你可以用Workbook_SheetSelectionChange时间,即选择区域改变是执行,也就是其他单元格点下就行了~Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
With ActiveSheet.PageSetup
.RightHeader = "&""Arial""&10&A " &Cells(4, 4) &"Page &P/&N"
End With
End Sub
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)