ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error in my code? (https://www.excelbanter.com/excel-programming/302153-error-my-code.html)

Matt

Error in my code?
 
I am getting an "Object required" Error when I run this code. I want the colorindex of these cells to change before it prints. Is there another way to have this code work? Can I not reference an object on the spreadsheet in the This Workbook section? Thanks in advance. Matt

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.BlackAndWhite = True
If cbExempt.Value = True Then
Range("C31,E31,G31,I31,K31,M31,O31").Font.ColorInd ex = 2
End If
End Sub


All times are GMT +1. The time now is 05:38 PM.

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