Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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, |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding last occurence of Interior.ColorIndex 36 | New Users to Excel | |||
Sumif interior.colorindex condition | Excel Worksheet Functions | |||
interior.colorindex used with conditional formatting | Excel Worksheet Functions | |||
VBA syntax for Font & Interior ColorIndex | Excel Discussion (Misc queries) | |||
Testing for Interior.ColorIndex | Excel Programming |