Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am receiving an "Object Required" Error when I run this code. I want the colorindex to change on this group of cells before the spreadsheet prints. Can I not reference an object on the spreadsheet in the This Workbook area? Is there a better way to do this? 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Where is cbExempt? (assume it is an activeX combobox) It should have some
qualification on it. I put Activesheet as an illustration. Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.BlackAndWhite = True If Activesheet.cbExempt.Value = True Then ActiveSheet.Range("C31,E31,G31,I31,K31,M31,O31").F ont.ColorIndex = 2 End If End Sub -- Regards, Tom Ogilvy "Matt" wrote in message ... I am receiving an "Object Required" Error when I run this code. I want the colorindex to change on this group of cells before the spreadsheet prints. Can I not reference an object on the spreadsheet in the This Workbook area? Is there a better way to do this? 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code error | Excel Discussion (Misc queries) | |||
How can I still go to the error-code after a On Error Goto? | Excel Programming | |||
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) | Excel Programming | |||
More to Error in code | Excel Programming | |||
Error in Code | Excel Programming |