Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cell.interior.colorindex - does not work in Excel 97

I have the following code in an excel 2000 spreadsheet:



Private Sub CommandButton1_Click()

For Each cell In Range("c5:H32")
cell.Interior.ColorIndex = 0
Next cell

End Sub




But it does not work in Excel 97.

Any ideas why? I get run time error 1004

Ian,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Cell.interior.colorindex - does not work in Excel 97

Hi Ian

0 not exist
White is colorindex -4142

Try this in 97
ActiveCell.Interior.ColorIndex = -4142


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ian" wrote in message ...
I have the following code in an excel 2000 spreadsheet:



Private Sub CommandButton1_Click()

For Each cell In Range("c5:H32")
cell.Interior.ColorIndex = 0
Next cell

End Sub




But it does not work in Excel 97.

Any ideas why? I get run time error 1004

Ian,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cell.interior.colorindex - does not work in Excel 97

On Tue, 5 Apr 2005 17:23:08 +0200, "Ron de Bruin"
wrote:

Hi Ian

0 not exist
White is colorindex -4142

Try this in 97
ActiveCell.Interior.ColorIndex = -4142



Sorry, Ron,

Still does not work.

Cheers,

Ian,
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Cell.interior.colorindex - does not work in Excel 97

Is it working if you run the macro with Alt-F8 instead of
using the button

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ian" wrote in message ...
On Tue, 5 Apr 2005 17:23:08 +0200, "Ron de Bruin"
wrote:

Hi Ian

0 not exist
White is colorindex -4142

Try this in 97
ActiveCell.Interior.ColorIndex = -4142



Sorry, Ron,

Still does not work.

Cheers,

Ian,



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Cell.interior.colorindex - does not work in Excel 97

Ron & Ian.

xlAutomatic = -4105
xlNone = -4142

Font cannot be formatted with xlnone, colorindex 1-56 or xlAutomatic only.
But "No Fill" for interior is xlNone.

Regards,
Peter T


"Ron de Bruin" wrote in message
...
Is it working if you run the macro with Alt-F8 instead of
using the button

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ian" wrote in message

...
On Tue, 5 Apr 2005 17:23:08 +0200, "Ron de Bruin"
wrote:

Hi Ian

0 not exist
White is colorindex -4142

Try this in 97
ActiveCell.Interior.ColorIndex = -4142



Sorry, Ron,

Still does not work.

Cheers,

Ian,







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cell.interior.colorindex - does not work in Excel 97

On Tue, 5 Apr 2005 17:34:14 +0200, "Ron de Bruin"
wrote:

Is it working if you run the macro with Alt-F8 instead of
using the button



I hve put the code in a macro and run it with AltF8
and it does not work, does it does not show up n error.

Ian,
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Cell.interior.colorindex - does not work in Excel 97

HIi Ian

I will setup a virtual pc with Excel 97 now to test it.




--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ian" wrote in message ...
On Tue, 5 Apr 2005 17:34:14 +0200, "Ron de Bruin"
wrote:

Is it working if you run the macro with Alt-F8 instead of
using the button



I hve put the code in a macro and run it with AltF8
and it does not work, does it does not show up n error.

Ian,



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Cell.interior.colorindex - does not work in Excel 97


If you change the takefocusonclick property of the button to false
you don't see the 1004 error (bug in 97)

The code is working for me in Excel 97 as a sub and in the click event of the button

But if your colors are a result of Format conditional formatting it is not working.
Is that true ?

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ian" wrote in message ...
On Tue, 5 Apr 2005 17:34:14 +0200, "Ron de Bruin"
wrote:

Is it working if you run the macro with Alt-F8 instead of
using the button



I hve put the code in a macro and run it with AltF8
and it does not work, does it does not show up n error.

Ian,



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Cell.interior.colorindex - does not work in Excel 97

Sorry folks - somehow I read you were changing font.
Must be going dyslexic!


xlAutomatic = -4105
xlNone = -4142

Font cannot be formatted with xlnone, colorindex 1-56 or xlAutomatic only.
But "No Fill" for interior is xlNone.

Regards,
Peter T



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cell.interior.colorindex - does not work in Excel 97

On Tue, 5 Apr 2005 19:01:43 +0200, "Ron de Bruin"
wrote:


If you change the takefocusonclick property of the button to false
you don't see the 1004 error (bug in 97)

The code is working for me in Excel 97 as a sub and in the click event of the button

But if your colors are a result of Format conditional formatting it is not working.
Is that true ?


Thanks, Ron. That has sorted it !

It works perfect now.

Many thanks.

Ian,


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Cell.interior.colorindex - does not work in Excel 97

You are welcome

You confused me with saying that the sub not work

I hve put the code in a macro and run it with AltF8
and it does not work, does it does not show up n error.



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ian" wrote in message ...
On Tue, 5 Apr 2005 19:01:43 +0200, "Ron de Bruin"
wrote:


If you change the takefocusonclick property of the button to false
you don't see the 1004 error (bug in 97)

The code is working for me in Excel 97 as a sub and in the click event of the button

But if your colors are a result of Format conditional formatting it is not working.
Is that true ?


Thanks, Ron. That has sorted it !

It works perfect now.

Many thanks.

Ian,



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
Finding last occurence of Interior.ColorIndex 36 Linda New Users to Excel 2 May 28th 10 07:04 AM
Sumif interior.colorindex condition John Excel Worksheet Functions 7 June 1st 06 01:17 AM
interior.colorindex used with conditional formatting Wazooli Excel Worksheet Functions 7 February 25th 05 01:01 AM
VBA syntax for Font & Interior ColorIndex Dennis Excel Discussion (Misc queries) 1 November 25th 04 07:38 PM
Testing for Interior.ColorIndex JeffBo Excel Programming 7 May 17th 04 09:41 PM


All times are GMT +1. The time now is 07:04 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"