Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Error in my code?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error in my code?

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error in my code?

I think it depends on the printer. Some printers recognize there is no
contrast and correct for it - I guess yours does that.

--
Regards,
Tom Ogilvy

"Matt" wrote in message
...
Yes, it is an activeX combobox. If I set the page setup to .BlackAndWhite

can I not change the color of text to white? I changed the code to give it
qualification but it still prints the text in black. The combo box is on
Sheet1. Thanks.

"Tom Ogilvy" wrote:

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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error in my code?

sheet1.cbExempt.Value

or

IF Worksheets("sheet1").cbExempt.Value = True then

--
Regards,
Tom Ogilvy

"Matt" wrote in message
...
How would I reference my combo box? My combo box name is cbExempt. If I

were referencing it, how would I finish this statement:

If Activesheet. ? .value = true then

Thanks

"Tom Ogilvy" wrote:

I think it depends on the printer. Some printers recognize there is no
contrast and correct for it - I guess yours does that.

--
Regards,
Tom Ogilvy

"Matt" wrote in message
...
Yes, it is an activeX combobox. If I set the page setup to

..BlackAndWhite
can I not change the color of text to white? I changed the code to give

it
qualification but it still prints the text in black. The combo box is

on
Sheet1. Thanks.

"Tom Ogilvy" wrote:

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
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
Code error N.F[_2_] Excel Discussion (Misc queries) 1 July 2nd 07 11:13 PM
How can I still go to the error-code after a On Error Goto? Michel[_3_] Excel Programming 2 May 4th 04 04:21 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM
More to Error in code Julie Excel Programming 4 November 4th 03 06:10 PM
Error in Code Julie Excel Programming 1 October 31st 03 11:28 PM


All times are GMT +1. The time now is 10:59 PM.

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

About Us

"It's about Microsoft Excel"