LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Formatting a Pivot Table

Hidden and expanded rows and columns don't seem to have any adverse affect in
my test workbook. I hid detail and also tried various combinations of
grouping and collapsing the groups. I ran all tests on both column-dominated
and row-dominated pivot tables. The linestyles are set with no errors.

Can you manually adjust the linestyles in Column A cells? Using Excel's
menu, try Format, Cells, Borders. Set a diagonal to visible and click OK.
Then try to clear it using the same menu maneuever and see what happens.

---
Jay


"NevilleT" wrote:

Thanks a lot Jay. That is getting closer to the truth. The error occurs
only on column A (every cell). The pivot table is tracking resources
allocated to project. It has col A "Role", col B "Name", col C "Project" Col
D "Jan 07", Col E "Feb O7" etc. You can collapse the table to look at a
single role, a person within the role, or expand it fully to display each
combination of role, name and project. Could it be something to do with the
fact that you can expand or hide the column?

"Jay" wrote:

Hi NevilleT-

I can't reproduce your error; the code works fine on a test pivot table (as
you've described for your other sheets). I'd suggest converting your code as
follows to report the cell address where the error occurs; that might provide
us with a clue about the cause. Does the error occur when formatting all
cells or just in a particular column or row? Use Ctrl-Break if to stop this
procedure if all cells seem to be causing the error (so you don't have to
respond to ~1200 error messages...).

Sub NevilleT()

Set rng = ActiveSheet.Range("A5:B600")

For Each cel In rng
On Error GoTo errorReport
cel.Interior.ColorIndex = xlNone
cel.Borders(xlDiagonalDown).LineStyle = xlNone ' Error occurs here
cel.Borders(xlDiagonalUp).LineStyle = xlNone
On Error GoTo 0
nextCel:
Next 'cel

normalExit:
Exit Sub

errorReport:
MsgBox "An error occurred when formatting cell " & cel.Address
Resume nextCel

End Sub

----
Jay




"NevilleT" wrote:

I posted this message before but didn't resolve it. I have a pivot table I
am trying to format. The sheet is unprotected and the code fails with an
error

"Unable to set the linestyle property of the border class"

It does however work correctly on other worksheets in the same workbook.

Dim rng As Range

Set rng = ActiveSheet.Range("A5:B600")
rng.Interior.ColorIndex = xlNone
rng.Borders(xlDiagonalDown).LineStyle = xlNone ' Error occurs here
rng.Borders(xlDiagonalUp).LineStyle = xlNone

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 Excel Table and Pivot Table Formatting sanmos Excel Discussion (Misc queries) 0 February 9th 10 12:07 AM
Pivot Table Row Formatting T Duquette Excel Worksheet Functions 1 April 28th 06 05:13 PM
Pivot Table border formatting and pivot chart formatting [email protected] Excel Discussion (Misc queries) 0 July 22nd 05 02:22 PM
Pivot Table Formatting Scott Excel Discussion (Misc queries) 1 July 9th 05 04:51 AM
Formatting pivot table Tom Ogilvy Excel Programming 2 July 31st 03 11:14 PM


All times are GMT +1. The time now is 08:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"