ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do you create a page border in Excel? (https://www.excelbanter.com/excel-discussion-misc-queries/46777-how-do-you-create-page-border-excel.html)

Tricia

How do you create a page border in Excel?
 
I have data that spans several pages and would like a page border on the
printed copy. How can I do this without selecting the range of cells on
every page and outlining with border. My data changes and this is a real
pain to re-do every time.

David McRitchie

Hi Tricia,
Page borders apply to the entire worksheet, doesn't make any difference
what cells are selected, unless you ask to print a selected range, which
would be similar to limiting your print area. Have you tried
File, Page Setup, General, Fit to 1 pages wide, the fit to pages high is
and independent setting which you can leave empty.
-
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Tricia" wrote in message ...
I have data that spans several pages and would like a page border on the
printed copy. How can I do this without selecting the range of cells on
every page and outlining with border. My data changes and this is a real
pain to re-do every time.





David McRitchie

Hi Tricia,
I guess I missed the point, I was talking about page margins.
The easiest way to change margins is to be in Print Preview mode and then
use the Margins tab, drag the margins to where you want them.

But you are probably asking about getting a heavy border outline at the margins of each
page, or least around the aggregate of all cells on a page, and I don't have
a solution for that.

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm




"Tricia" wrote in message ...
I have data that spans several pages and would like a page border on the
printed copy. How can I do this without selecting the range of cells on
every page and outlining with border. My data changes and this is a real
pain to re-do every time.







David McRitchie

Hi Tricia,
I think this will do what you ask for, but I would not recommend it
Partly because it is based on the used region, which is not properly
maintained in Excel. Also it will destroy other cell borders, and you
will have the bold border around the formerly used region if you
add more rows or columns. I think it would make a mess.

If you still want to go ahead, knowing that you will be forced thereafter
to run the macro again and again, and lose your other borders then
you would install the following macro and invoke it manually.

If not familiar with macros see my page on Getting Started with macros
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Option Explicit
Sub Macro11()
Dim wkSheet As Worksheet
Dim x As Long, cSht As Long, rng As Range
' For Each wkSheet In Application.ActiveWorkbook
'- change to the ones that are grouped
For Each wkSheet In Application.ActiveWorkbook. _
Windows(1).SelectedSheets
'-- Clear all borders
Cells.Borders(xlDiagonalDown).LineStyle = xlNone
Cells.Borders(xlDiagonalUp).LineStyle = xlNone
Cells.Borders(xlEdgeLeft).LineStyle = xlNone
Cells.Borders(xlEdgeTop).LineStyle = xlNone
Cells.Borders(xlEdgeBottom).LineStyle = xlNone
Cells.Borders(xlEdgeRight).LineStyle = xlNone
Cells.Borders(xlInsideVertical).LineStyle = xlNone
Cells.Borders(xlInsideHorizontal).LineStyle = xlNone

'-- thick border around usedrange
Set rng = wkSheet.UsedRange
With rng.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
' .ColorIndex = 3 'activate for a RED border
End With
With rng.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 3
End With
With rng.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
' .ColorIndex = 3
End With
With rng.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
' .ColorIndex = 3
End With
Next wkSheet
If Application.ActiveWorkbook. _
Windows(1).SelectedSheets.Count 1 Then
MsgBox "Please UNGROUP sheets to avoid damaging workbook"
End If
End Sub

--
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"David McRitchie" wrote in message ...
Hi Tricia,
I guess I missed the point, I was talking about page margins.
The easiest way to change margins is to be in Print Preview mode and then
use the Margins tab, drag the margins to where you want them.

But you are probably asking about getting a heavy border outline at the margins of each
page, or least around the aggregate of all cells on a page, and I don't have
a solution for that.

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm




"Tricia" wrote in message ...
I have data that spans several pages and would like a page border on the
printed copy. How can I do this without selecting the range of cells on
every page and outlining with border. My data changes and this is a real
pain to re-do every time.









Tricia

I am asking about getting a heavy border outline at the margins and I can't
find an easier way either. Thank you for responding to my question.

"David McRitchie" wrote:

Hi Tricia,
I guess I missed the point, I was talking about page margins.
The easiest way to change margins is to be in Print Preview mode and then
use the Margins tab, drag the margins to where you want them.

But you are probably asking about getting a heavy border outline at the margins of each
page, or least around the aggregate of all cells on a page, and I don't have
a solution for that.

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm




"Tricia" wrote in message ...
I have data that spans several pages and would like a page border on the
printed copy. How can I do this without selecting the range of cells on
every page and outlining with border. My data changes and this is a real
pain to re-do every time.









All times are GMT +1. The time now is 02:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com