PC Review


Reply
Thread Tools Rate Thread

ColorIndex returns incorrect color

 
 
goss9394@yahoo.com
Guest
Posts: n/a
 
      10th Oct 2006
Hi all

Trying to set interrior colorindex to 80% grey which I belive is #56
Yet the cell appears filled black to me and definitely changes when I
copy format from one cell to the left

Also is there a way to expand the color utility below to list what the
color palette represents
For example for value 56 col C should read "Grey 80%"

Thanks
-goss


Snippet:
With wsData
For j = i To 2 Step -1
If InStr(.Cells(j, 18), "/Tax") Then
.Cells(j, 18).EntireRow.Delete
End If
Next
Set rngHead = .Range("R1")
With rngHead
.Value = "Switch"
.Interior.Color = 56
.Font.Bold = True
.Font.ColorIndex = 2
End With
End With

Color Index Utilities
Sub ListColorIndexes()
Dim wbBook As Workbook
Dim wsColorList As Worksheet
Dim Ndx As Long

Set wbBook = ThisWorkbook
Set wsColorList = wbBook.Worksheets("ColorList")

wsColorList.UsedRange.Clear

With wsColorList
For Ndx = 1 To 56
.Cells(Ndx, 1).Interior.ColorIndex = Ndx
.Cells(Ndx, 2).Formula = clr(.Cells(Ndx, 1))
Next Ndx
End With
End Sub

Function clr(R As Range) As Integer
With R.Interior
clr = .ColorIndex
End With
End Function

 
Reply With Quote
 
 
 
 
Sandy
Guest
Posts: n/a
 
      10th Oct 2006
It looks like to me just scanning your code that where you try and
change the cell backround color to #56 you are using color instead of
color index try changing that line and see if it works.

Also here is a link to a function from a previous post that will return
the color description

http://www.ozgrid.com/VBA/ReturnCellColor.htm


Sandy



(E-Mail Removed) wrote:
> Hi all
>
> Trying to set interrior colorindex to 80% grey which I belive is #56
> Yet the cell appears filled black to me and definitely changes when I
> copy format from one cell to the left
>
> Also is there a way to expand the color utility below to list what the
> color palette represents
> For example for value 56 col C should read "Grey 80%"
>
> Thanks
> -goss
>
>
> Snippet:
> With wsData
> For j = i To 2 Step -1
> If InStr(.Cells(j, 18), "/Tax") Then
> .Cells(j, 18).EntireRow.Delete
> End If
> Next
> Set rngHead = .Range("R1")
> With rngHead
> .Value = "Switch"
> .Interior.Color = 56
> .Font.Bold = True
> .Font.ColorIndex = 2
> End With
> End With
>
> Color Index Utilities
> Sub ListColorIndexes()
> Dim wbBook As Workbook
> Dim wsColorList As Worksheet
> Dim Ndx As Long
>
> Set wbBook = ThisWorkbook
> Set wsColorList = wbBook.Worksheets("ColorList")
>
> wsColorList.UsedRange.Clear
>
> With wsColorList
> For Ndx = 1 To 56
> .Cells(Ndx, 1).Interior.ColorIndex = Ndx
> .Cells(Ndx, 2).Formula = clr(.Cells(Ndx, 1))
> Next Ndx
> End With
> End Sub
>
> Function clr(R As Range) As Integer
> With R.Interior
> clr = .ColorIndex
> End With
> End Function


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Color sort - any cell in row that has colorindex = 4 HarryisTrying Microsoft Excel Programming 7 10th Oct 2009 05:27 PM
SeriesCollection - Incorrect ColorIndex Assigned to Chart Bob Barnes Microsoft Excel Charting 11 2nd Jul 2009 12:02 AM
ColorIndex vs Color? Josh Sale Microsoft Excel Programming 8 1st Oct 2008 03:56 PM
tab.colorindex linked to cell color =?Utf-8?B?TWlrZQ==?= Microsoft Excel Worksheet Functions 2 12th Apr 2007 12:44 AM
Name of color for a particular colorindex number Hari Microsoft Excel Programming 2 8th Jun 2004 07:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:22 PM.