Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default ColorIndex returns incorrect color

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default ColorIndex returns incorrect color

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



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
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
SeriesCollection - Incorrect ColorIndex Assigned to Chart Bob Barnes Charts and Charting in Excel 11 July 2nd 09 12:02 AM
Pmt formula returns incorrect answer Heinz Excel Discussion (Misc queries) 2 June 6th 08 01:10 AM
DCount returns incorrect Result dee Excel Worksheet Functions 2 April 26th 07 08:54 PM
Like with * returns incorrect sheet name marianne Excel Programming 3 May 24th 06 03:00 AM
sumif formula returns incorrect value modular_brian Excel Worksheet Functions 1 June 16th 05 10:29 PM


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