ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sub to list colorindexes and the corresponding fill colours (https://www.excelbanter.com/excel-programming/330604-re-sub-list-colorindexes-corresponding-fill-colours.html)

K Dales[_2_]

Sub to list colorindexes and the corresponding fill colours
 
Not sure exactly what you want, but this sub will give the colorindex in
column A, the corresponding color value (numeric, the RGB value) in column B,
and will fill the cell in column C with the specified color:

Public Sub ShowFillColors()

For i = 1 To 56
Sheets("Sheet1").Range("A" & i).Value = i
Sheets("Sheet1").Range("C" & i).Interior.ColorIndex = i
Sheets("Sheet1").Range("B" & i).Value = Sheets("Sheet1").Range("C" &
i).Interior.Color
Next i

End Sub


"Max" wrote:

Hi guys,

(Apologies for the earlier post w/o any subject line)

I'm looking for a sub which can list all the colorindexes down say col A,
and all the corresponding fill colors in col B ?

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----




Max

Sub to list colorindexes and the corresponding fill colours
 
Thanks, K Dales !
Marvellous, spot on !
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"K Dales" wrote in message
...
Not sure exactly what you want, but this sub will give the colorindex in
column A, the corresponding color value (numeric, the RGB value) in column

B,
and will fill the cell in column C with the specified color:

Public Sub ShowFillColors()

For i = 1 To 56
Sheets("Sheet1").Range("A" & i).Value = i
Sheets("Sheet1").Range("C" & i).Interior.ColorIndex = i
Sheets("Sheet1").Range("B" & i).Value = Sheets("Sheet1").Range("C" &
i).Interior.Color
Next i

End Sub





All times are GMT +1. The time now is 12:32 PM.

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