ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   unable to set the colorindex property of the font class (https://www.excelbanter.com/excel-programming/285637-unable-set-colorindex-property-font-class.html)

steve

unable to set the colorindex property of the font class
 
re the code below, the code will only execute if called
from a form when the spreadsheet is loading. If I call the
code from a button on the sheet itself I obtain an error -

"unable to set the colorindex property of the font class"

I would love an explanation of the problems with the code

Steve

Sub Reveal_Cells(Rng As Range, Default_Value As Variant)
Rng.Interior.ColorIndex = 19
Rng.Font.ColorIndex = 5
Rng.Value = Default_Value
End Sub

patrick molloy

unable to set the colorindex property of the font class
 
works fine for me. Are you passing a range & value? Is
the cell/sheet protected?

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
re the code below, the code will only execute if called
from a form when the spreadsheet is loading. If I call

the
code from a button on the sheet itself I obtain an

error -

"unable to set the colorindex property of the font class"

I would love an explanation of the problems with the code

Steve

Sub Reveal_Cells(Rng As Range, Default_Value As Variant)
Rng.Interior.ColorIndex = 19
Rng.Font.ColorIndex = 5
Rng.Value = Default_Value
End Sub
.


steve

unable to set the colorindex property of the font class
 

Yes I pass in a range + value. The worksheet is not
protected. What is odd is that the line

Rng.Value = Default_Value

Will work fine if the others are commented out, all the
others to do with colors etc cause exceptions if run at
any time other than startup.

I should mention I am using excel 97

thanks

Steve

-----Original Message-----
works fine for me. Are you passing a range & value? Is
the cell/sheet protected?

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
re the code below, the code will only execute if called
from a form when the spreadsheet is loading. If I call

the
code from a button on the sheet itself I obtain an

error -

"unable to set the colorindex property of the font class"

I would love an explanation of the problems with the code

Steve

Sub Reveal_Cells(Rng As Range, Default_Value As Variant)
Rng.Interior.ColorIndex = 19
Rng.Font.ColorIndex = 5
Rng.Value = Default_Value
End Sub
.

.


patrick molloy

unable to set the colorindex property of the font class
 
is the procedure on a userform's code?
make sure the form is loaded by the button

Patrick
-----Original Message-----

Yes I pass in a range + value. The worksheet is not
protected. What is odd is that the line

Rng.Value = Default_Value

Will work fine if the others are commented out, all the
others to do with colors etc cause exceptions if run at
any time other than startup.

I should mention I am using excel 97

thanks

Steve

-----Original Message-----
works fine for me. Are you passing a range & value? Is
the cell/sheet protected?

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
re the code below, the code will only execute if

called
from a form when the spreadsheet is loading. If I call

the
code from a button on the sheet itself I obtain an

error -

"unable to set the colorindex property of the font

class"

I would love an explanation of the problems with the

code

Steve

Sub Reveal_Cells(Rng As Range, Default_Value As

Variant)
Rng.Interior.ColorIndex = 19
Rng.Font.ColorIndex = 5
Rng.Value = Default_Value
End Sub
.

.

.



All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com