Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Clearing Interior Colours or all sheets

I am using this code to clear the interior colour of all
the worksheets in my workbook. When I run it, I get an
run time error 1004 "Unable to set Color Index Property of
Inerior Class. Why is this happening?


Answer = MsgBox(Prompt:="You have decided to print a
colour map. Accordingly, this routine will change all
your current formatting in the model to white in order to
colour it effectively. Please note that this will also
take out the existing conditionl formatting in the
spreadsheet.", Buttons:=vbYesNo + vbQuestion)
If Answer = vbYes Then
'Change colour index to white
'Also take out conditional formatting
For Each sh In ActiveWorkbook.Worksheets
sh.Cells.Interior.ColorIndex = xlNone
sh.Cells.FormatConditions.Delete
Next sh

End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clearing Interior Colours or all sheets

If your running this from a commandbutton in xl97, then set the takefocus on
click property of the command button to false.

Otherwise, my suspicion would be you have merged cells on one of your
sheets. However, in xl2003 it still ran with merged cells - so this is only
a guess.

If that isn't it, figure out which sheet is causing the error and see what
is unique about the sheet.

--
Regards,
Tom Ogilvy

"ExcelMonkey" wrote in message
...
I am using this code to clear the interior colour of all
the worksheets in my workbook. When I run it, I get an
run time error 1004 "Unable to set Color Index Property of
Inerior Class. Why is this happening?


Answer = MsgBox(Prompt:="You have decided to print a
colour map. Accordingly, this routine will change all
your current formatting in the model to white in order to
colour it effectively. Please note that this will also
take out the existing conditionl formatting in the
spreadsheet.", Buttons:=vbYesNo + vbQuestion)
If Answer = vbYes Then
'Change colour index to white
'Also take out conditional formatting
For Each sh In ActiveWorkbook.Worksheets
sh.Cells.Interior.ColorIndex = xlNone
sh.Cells.FormatConditions.Delete
Next sh

End If



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Clearing Interior Colours or all sheets

Hi

it works fine for me ... XL 2003 ... do you have any protected sheets in
your workbook?

Cheers
JulieD

"ExcelMonkey" wrote in message
...
I am using this code to clear the interior colour of all
the worksheets in my workbook. When I run it, I get an
run time error 1004 "Unable to set Color Index Property of
Inerior Class. Why is this happening?


Answer = MsgBox(Prompt:="You have decided to print a
colour map. Accordingly, this routine will change all
your current formatting in the model to white in order to
colour it effectively. Please note that this will also
take out the existing conditionl formatting in the
spreadsheet.", Buttons:=vbYesNo + vbQuestion)
If Answer = vbYes Then
'Change colour index to white
'Also take out conditional formatting
For Each sh In ActiveWorkbook.Worksheets
sh.Cells.Interior.ColorIndex = xlNone
sh.Cells.FormatConditions.Delete
Next sh

End If



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Clearing Interior Colours or all sheets

Yep protected sheets were the culprit! Thanks


-----Original Message-----
Hi

it works fine for me ... XL 2003 ... do you have any

protected sheets in
your workbook?

Cheers
JulieD

"ExcelMonkey" wrote

in message
...
I am using this code to clear the interior colour of all
the worksheets in my workbook. When I run it, I get an
run time error 1004 "Unable to set Color Index Property

of
Inerior Class. Why is this happening?


Answer = MsgBox(Prompt:="You have decided to print a
colour map. Accordingly, this routine will change all
your current formatting in the model to white in order

to
colour it effectively. Please note that this will also
take out the existing conditionl formatting in the
spreadsheet.", Buttons:=vbYesNo + vbQuestion)
If Answer = vbYes Then
'Change colour index to white
'Also take out conditional formatting
For Each sh In ActiveWorkbook.Worksheets
sh.Cells.Interior.ColorIndex = xlNone
sh.Cells.FormatConditions.Delete
Next sh

End If



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Clearing Interior Colours or all sheets

you're welcome and thanks for the feedback


"ExcelMonkey" wrote in message
...
Yep protected sheets were the culprit! Thanks


-----Original Message-----
Hi

it works fine for me ... XL 2003 ... do you have any

protected sheets in
your workbook?

Cheers
JulieD

"ExcelMonkey" wrote

in message
...
I am using this code to clear the interior colour of all
the worksheets in my workbook. When I run it, I get an
run time error 1004 "Unable to set Color Index Property

of
Inerior Class. Why is this happening?


Answer = MsgBox(Prompt:="You have decided to print a
colour map. Accordingly, this routine will change all
your current formatting in the model to white in order

to
colour it effectively. Please note that this will also
take out the existing conditionl formatting in the
spreadsheet.", Buttons:=vbYesNo + vbQuestion)
If Answer = vbYes Then
'Change colour index to white
'Also take out conditional formatting
For Each sh In ActiveWorkbook.Worksheets
sh.Cells.Interior.ColorIndex = xlNone
sh.Cells.FormatConditions.Delete
Next sh

End If



.





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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
colours in spread sheets Llanelli lad Excel Discussion (Misc queries) 2 March 16th 09 11:00 PM
Excel 2003 font colours and cell colours bretta Excel Discussion (Misc queries) 1 April 17th 05 03:45 AM
Select All Sheets and clear Interior Cell colours Gord Dibben Excel Programming 0 March 21st 05 11:28 PM
Code to change interior colour only if current interior colour is BeSmart Excel Programming 2 October 5th 04 12:06 AM


All times are GMT +1. The time now is 05:24 AM.

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"