View Single Post
  #4   Report Post  
David McRitchie
 
Posts: n/a
Default

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.