Thread: [Solved] Bottom Line in every page
View Single Post
 
Old 08-16-2022, 08:44 AM
Marcia's Avatar
Marcia Marcia is offline Windows 10 Office 2019
Expert
 
Join Date: May 2018
Location: Philippines
Posts: 527
Marcia has a spectacular aura aboutMarcia has a spectacular aura aboutMarcia has a spectacular aura about
Default Bottom Line in every page

Hi. I found in another site a code that draws a bottom line at every page of a data sheet. I would prefer that the vba need not show a print preview and the bottom line should be drawn from col B to F.
Thank you for all the help, past and present.
Code:
Sub BottomLine()
Dim ws As Worksheet
Dim pb As HPageBreak
Dim LastRow As Long


For Each ws In ThisWorkbook.Worksheets
ActiveWindow.View = xlPageBreakPreview

For Each pb In ws.HPageBreaks
LastRow = pb.Location.Offset(-1, 0).Row

With ws.Rows(LastRow).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
Next pb
Next ws
End Sub
Attached Files
File Type: xlsm Lines.xlsm (45.5 KB, 4 views)
Reply With Quote