How to create a page border in Excel with VBA
Automatically create a page border on any worksheet in Excel. Create a thick border around the edge of the printed page.
Check out my online courses
Code
Sub Page_borders()
Dim rngBorder As Range
Dim lngLastRow As Long
Dim lngLastCol As Long
Dim fstRow As Long
Dim fstCol As Long
Dim printRng As Range
Set printRng = Range(“A1:I46”)
lngLastRow = printRng.Row + printRng.Rows.Count – 1
lngLastCol = printRng.Column + printRng.Columns.Count – 1
With ActiveSheet
fstRow = 1
fstCol = 1
Set rngBorder = .Range(.Cells(fstRow, fstCol), .Cells(lngLastRow, lngLastCol))
rngBorder.BorderAround xlContinuous, xlThick
End With
End Sub
For more help visit my website or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Excel one-on-one on-line training available. Email me to arrange.
I am able to provide online help on your computer at a reasonable rate.
Check out my next one-hour Excel Webinar
I use a Blue condensor Microphone to record my videos, here is the link
Check out Crowdcast for creating your webinars
If you need to buy Office 2019 follow
I use Tube Buddy to help promote my videos
Check them out
Follow me on Facebook
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.
Watch more new videos about Excel Office | Synthesized by Mindovermetal English
Great video, though I'm having trouble trying to tweak this script in order to work for all active pages in a worksheet.
How make no page