ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Formatting (https://www.excelbanter.com/excel-programming/350975-conditional-formatting.html)

Michael Rekas[_3_]

Conditional Formatting
 
Hi there

My macro generates a Sales by Product by Customer PivotTable with 3
columns i.e. Product, Customer and Total.

Automatic subtotal are generated at each change of Product (Column A)

I then insert the following Conditional Format in the entire
PivotTable range which makes it look great.

Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(RIGHT($A1,5)=""Total"",1,0)"
Selection.FormatConditions(1).Font.Bold = True
Selection.FormatConditions(1).Borders(xlLeft).Line Style =xlContinuous
Selection.FormatConditions(1).Borders(xlRight).Lin eStyle=xlContinuous
Selection.FormatConditions(1).Borders(xlTop).LineS tyle = xlContinuous
Selection.FormatConditions(1).Borders(xlBottom).Li neStyle =
xlContinuous
Selection.FormatConditions(1).Interior.ColorIndex = 15

As I said, it looks good on screen and in Print Preview.

However when I click on Print, message "EXCEL.exe has generated
errors and will be closed by Windows". I have tried on different PCs
as well as with different printers.

I am using Excel 2000.

Any way to resolve this or track why this is happening?

Thanks

Michael

David Frette[_2_]

Conditional Formatting
 
Have you isolated the issue to the conditional formatting?

NO - Then do so. Perhaps run the code and at the end of the code, delete the
conditional formatting. Then print. If no error, you've essentially isolated
the issue.

YES - Well, your only hope is someone has seen this and opened a ticket with
MS and had it resolved. Your company MSDN administrator could open a ticket
if you have that support level. If not, you may be able to open one youself,
but it costs $.

Other thing you could try - run the code. save. close. reopen. print.
perhaps that will work and help further isolate the problem.

"Michael Rekas" wrote:

Hi there

My macro generates a Sales by Product by Customer PivotTable with 3
columns i.e. Product, Customer and Total.

Automatic subtotal are generated at each change of Product (Column A)

I then insert the following Conditional Format in the entire
PivotTable range which makes it look great.

Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(RIGHT($A1,5)=""Total"",1,0)"
Selection.FormatConditions(1).Font.Bold = True
Selection.FormatConditions(1).Borders(xlLeft).Line Style =xlContinuous
Selection.FormatConditions(1).Borders(xlRight).Lin eStyle=xlContinuous
Selection.FormatConditions(1).Borders(xlTop).LineS tyle = xlContinuous
Selection.FormatConditions(1).Borders(xlBottom).Li neStyle =
xlContinuous
Selection.FormatConditions(1).Interior.ColorIndex = 15

As I said, it looks good on screen and in Print Preview.

However when I click on Print, message "EXCEL.exe has generated
errors and will be closed by Windows". I have tried on different PCs
as well as with different printers.

I am using Excel 2000.

Any way to resolve this or track why this is happening?

Thanks

Michael



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

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