Pivot Table Borders

  • Thread starter Andrew Ofthesong
  • Start date
A

Andrew Ofthesong

Hi.. Perhaps is an easy question, but i can't so it.... How can i make inner
borders for the data displayed in a pivot table??

I have like 20 column titles and 50 row titles, and is difficult for users
to follow up data....

When i do the borders, on next update they are gone...

Perhaps i can trap the refresh methos of the table on code to assign a
fomatting?
 
E

Ed Ferrero

Hi Andrew,
Hi.. Perhaps is an easy question, but i can't so it.... How can i make inner
borders for the data displayed in a pivot table??

I have like 20 column titles and 50 row titles, and is difficult for users
to follow up data....

When i do the borders, on next update they are gone...

Perhaps i can trap the refresh methos of the table on code to assign a
fomatting?

Put this in the sheet code.
Because it runs on the sheet calculate event, it will run when the
pivot table is refreshed. However, be careful because if you have
formulas that reference the pivot table, the code may run more than
once. It may be better to run this sort of code from a button.

Private Sub Worksheet_Calculate()
Dim pvt As PivotTable
' this formats all pivot tables on the active sheet
' with a double line outside border and a single
' line inside border

For Each pvt In ActiveSheet.PivotTables
With pvt.TableRange2
With .Borders
.LineStyle = xlContinuous
.LineStyle = xlDouble
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
End With
End With
Next pvt
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top