Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default setting interior color - error

I have some code including the following statement. It worked fine for months
but all of a sudden I'm getting an error message from it. I have not changed
the names of the worksheets or locations of the cells. The With statement
this is in the middle of represents the "Crew" worksheet.

activeworkbook.worksheets("Crew") .Range(.Cells(2, 12), .Cells(4,
12)).Interior.Color = RGB(180, 180, 180)

"Unable to set the Clor property of the interior class."

Any ideas on why this suddenly no longer works?

Thanks,
hanshil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default setting interior color - error

You're not showing us the With or End With statements.
ActiveWorkbook.Worksheets("Crew") would be part of the With statement. When I
rewrote your code as follows, it executed perfectly in Excel 2003:

With ActiveWorkbook.Worksheets("Crew")
.Range(.Cells(2, 12), .Cells(4, 12)).Interior.Color = RGB(180, 180, 180)
End With

Hope this helps,

Hutch

"hanshil" wrote:

I have some code including the following statement. It worked fine for months
but all of a sudden I'm getting an error message from it. I have not changed
the names of the worksheets or locations of the cells. The With statement
this is in the middle of represents the "Crew" worksheet.

activeworkbook.worksheets("Crew") .Range(.Cells(2, 12), .Cells(4,
12)).Interior.Color = RGB(180, 180, 180)

"Unable to set the Clor property of the interior class."

Any ideas on why this suddenly no longer works?

Thanks,
hanshil

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default setting interior color - error

Hutch,

code as I have it presently:

With ActiveWorkbook
.Names.Add Name:="st", RefersToR1C1:="=Crew!R2C12"
.Names.Add Name:="ot", RefersToR1C1:="=Crew!R3C12"
.Names.Add Name:="dt", RefersToR1C1:="=Crew!R4C12"
With .Worksheets("Crew")
.Range(.Cells(2, 12), .Cells(4, 12)).Interior.Color =
RGB(180, 180, 180)
.Range(.Cells(2, 13), .Cells(4, 13)).Interior.ColorIndex
= xlColorIndexNone
End With
End With

It has no problem with the defined names but it chokes on the color. Used to
work just fine but then suddenly decided it didn't like it. Its doing the
same thing on another machine.

Thanks,
Hans

"Tom Hutchins" wrote:

You're not showing us the With or End With statements.
ActiveWorkbook.Worksheets("Crew") would be part of the With statement. When I
rewrote your code as follows, it executed perfectly in Excel 2003:

With ActiveWorkbook.Worksheets("Crew")
.Range(.Cells(2, 12), .Cells(4, 12)).Interior.Color = RGB(180, 180, 180)
End With

Hope this helps,

Hutch

"hanshil" wrote:

I have some code including the following statement. It worked fine for months
but all of a sudden I'm getting an error message from it. I have not changed
the names of the worksheets or locations of the cells. The With statement
this is in the middle of represents the "Crew" worksheet.

activeworkbook.worksheets("Crew") .Range(.Cells(2, 12), .Cells(4,
12)).Interior.Color = RGB(180, 180, 180)

"Unable to set the Clor property of the interior class."

Any ideas on why this suddenly no longer works?

Thanks,
hanshil

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default setting interior color - error

I can't see any obvious reason why that would fail, unless you've protected
against format changes or as a very long shot have a missing references
(Tools references).

As a temporary fix in case of a missing ref' try
..Color = VBA.Information.RGB(180, 180, 180)
..Color = 12632256
..Color = -4142&

FWIW this grey does not exist in the default palette. Unless you've
customized a colour it will map to the nearest it can find, probably
colorindex 15 / rgb(192, 192, 192)

Regards,
Peter T


"hanshil" wrote in message
...
Hutch,

code as I have it presently:

With ActiveWorkbook
.Names.Add Name:="st", RefersToR1C1:="=Crew!R2C12"
.Names.Add Name:="ot", RefersToR1C1:="=Crew!R3C12"
.Names.Add Name:="dt", RefersToR1C1:="=Crew!R4C12"
With .Worksheets("Crew")
.Range(.Cells(2, 12), .Cells(4, 12)).Interior.Color =
RGB(180, 180, 180)
.Range(.Cells(2, 13), .Cells(4,

13)).Interior.ColorIndex
= xlColorIndexNone
End With
End With

It has no problem with the defined names but it chokes on the color. Used

to
work just fine but then suddenly decided it didn't like it. Its doing the
same thing on another machine.

Thanks,
Hans

"Tom Hutchins" wrote:

You're not showing us the With or End With statements.
ActiveWorkbook.Worksheets("Crew") would be part of the With statement.

When I
rewrote your code as follows, it executed perfectly in Excel 2003:

With ActiveWorkbook.Worksheets("Crew")
.Range(.Cells(2, 12), .Cells(4, 12)).Interior.Color = RGB(180, 180,

180)
End With

Hope this helps,

Hutch

"hanshil" wrote:

I have some code including the following statement. It worked fine for

months
but all of a sudden I'm getting an error message from it. I have not

changed
the names of the worksheets or locations of the cells. The With

statement
this is in the middle of represents the "Crew" worksheet.

activeworkbook.worksheets("Crew") .Range(.Cells(2, 12), .Cells(4,
12)).Interior.Color = RGB(180, 180, 180)

"Unable to set the Clor property of the interior class."

Any ideas on why this suddenly no longer works?

Thanks,
hanshil



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default setting interior color - error

there it is, thanks. silly me, I protected the sheet from format changes and
forgot to code in to lock & unlock it.
thanks.




"Peter T" wrote:

I can't see any obvious reason why that would fail, unless you've protected
against format changes or as a very long shot have a missing references
(Tools references).

As a temporary fix in case of a missing ref' try
..Color = VBA.Information.RGB(180, 180, 180)
..Color = 12632256
..Color = -4142&

FWIW this grey does not exist in the default palette. Unless you've
customized a colour it will map to the nearest it can find, probably
colorindex 15 / rgb(192, 192, 192)

Regards,
Peter T


"hanshil" wrote in message
...
Hutch,

code as I have it presently:

With ActiveWorkbook
.Names.Add Name:="st", RefersToR1C1:="=Crew!R2C12"
.Names.Add Name:="ot", RefersToR1C1:="=Crew!R3C12"
.Names.Add Name:="dt", RefersToR1C1:="=Crew!R4C12"
With .Worksheets("Crew")
.Range(.Cells(2, 12), .Cells(4, 12)).Interior.Color =
RGB(180, 180, 180)
.Range(.Cells(2, 13), .Cells(4,

13)).Interior.ColorIndex
= xlColorIndexNone
End With
End With

It has no problem with the defined names but it chokes on the color. Used

to
work just fine but then suddenly decided it didn't like it. Its doing the
same thing on another machine.

Thanks,
Hans

"Tom Hutchins" wrote:

You're not showing us the With or End With statements.
ActiveWorkbook.Worksheets("Crew") would be part of the With statement.

When I
rewrote your code as follows, it executed perfectly in Excel 2003:

With ActiveWorkbook.Worksheets("Crew")
.Range(.Cells(2, 12), .Cells(4, 12)).Interior.Color = RGB(180, 180,

180)
End With

Hope this helps,

Hutch

"hanshil" wrote:

I have some code including the following statement. It worked fine for

months
but all of a sudden I'm getting an error message from it. I have not

changed
the names of the worksheets or locations of the cells. The With

statement
this is in the middle of represents the "Crew" worksheet.

activeworkbook.worksheets("Crew") .Range(.Cells(2, 12), .Cells(4,
12)).Interior.Color = RGB(180, 180, 180)

"Unable to set the Clor property of the interior class."

Any ideas on why this suddenly no longer works?

Thanks,
hanshil






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
Cell background color (interior color) setting not working Martin E. Excel Programming 1 May 21st 06 07:00 PM
Problem with setting Interior Color in VBA cneumann Excel Programming 4 December 14th 05 03:37 PM
Problem with setting Interior Color in VBA cneumann Excel Programming 2 December 13th 05 10:56 PM
Passing Back Color to Interior Color ExcelMonkey[_190_] Excel Programming 1 March 22nd 05 04:27 PM
Problem in setting Cell Interior Color filling. Venkatachalam Excel Programming 1 September 29th 04 07:13 PM


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

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

About Us

"It's about Microsoft Excel"