- ·上一篇:怎么用excel插图教程
- ·下一篇:excel竖条怎么变成横的
excel怎么插入带公式的页眉
1.excel页眉页脚中怎样插入公式?
利用分节符可以实现不同页眉的显示。可以用一个宏来自动完成。
Sub test()
Dim pageNum As Long
Dim sectionNum As Long
Selection.HomeKey unit:=wdStory
With Selection.Find
.ClearFormatting
.Execute findText:="^b", ReplaceWith:="", Replace:=wdReplaceAll, Format:=False, Forward:=True, Wrap:=wdFindContinue
End With
ActiveDocument.Repaginate
pageNum = ActiveDocument.(wdPropertyPages)
sectionNum = 0
For i = 1 To pageNum
If i Mod 3 = 0 Then
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=(i + 1)
Selection.MoveUp unit:=wdLine, Count:=1
Selection.EndKey unit:=wdLine
Selection.InsertBreak Type:= '
sectionNum = sectionNum + 1
End If
Next i
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView _
Or ActiveWindow.ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
For i = 1 To (sectionNum + 1)
Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst, Count:=i
Selection.MoveDown unit:=wdScreen, Count:=1
ActiveWindow.ActivePane.View.SeekView =
If i >= 2 Then
Selection.HeaderFooter.LinkToPrevious = False
End If
Selection.HeaderFooter.Range.Delete
Selection.TypeText Text:="第" & i &; "批次体检人员名单"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Next i
Selection.HomeKey unit:=wdStory
End Sub
---------------------------------------
啊,我看错了,以为是Word里面的呢!白写了,呵呵。