ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fill Colour (https://www.excelbanter.com/excel-programming/379557-fill-colour.html)

Carrguy

Fill Colour
 
Is there away to chenge the default fill colour from yellow to a different
colour

John Coleman

Fill Colour
 
You would need to change the color pallete. Go to Tools -Options -
Color and select the yellow square then modify it to get the color you
want. You have now lost yellow from the pallete. If you need yellow for
some other purposes, you can modify some other color (perhaps the one
you just replaced yellow with) to be yellow. You can do this in code -
but if it is only 1 or 2 colors you want to change - this works fine.

HTH

-John Coleman

Carrguy wrote:
Is there away to chenge the default fill colour from yellow to a different
colour



John Coleman

Fill Colour
 
Another approach which will have the property that it will work with
all workbooks as soon as you open them (and not just the one you first
did the change with) is to put code like this in the workbook open
event of your personal macro workbook:

Private Sub Workbook_Open()
Dim wb As Workbook
For Each wb In Application.Workbooks
wb.Colors(6) = RGB(0, 255, 255) 'the default fill index
wb.Colors(8) = RGB(255, 255, 0) 'now index 8 holds yellow
Next wb
End Sub

This will interchange yellow and a light blue in the color palette. The
problem is - this will do it even in workbooks that you might not want
it to (if they already had some color customization). Run the following
code on a blank worksheet if you want to find what values to use in the
above sub (if you want something other than light blue):

Sub ShowColors()
'Based on fact that
'RGB(R, G, B) & " = " & 65536 * B + 256 * G + R
Dim i As Long, C As Long
Dim R As Long, G As Long, B As Long
Range("A1").Value = "Index"
Range("B1").Value = "Color"
Range("C1").Value = "R"
Range("D1").Value = "G"
Range("E1").Value = "B"
Range("F1").Value = "Check"
For i = 1 To 56
Range("A1").Offset(i, 0).Value = i
Range("B1").Offset(i, 0).Interior.ColorIndex = i
C = Range("B1").Offset(i, 0).Interior.Color
R = C Mod 256
G = ((C - R) Mod 65536) / 256
B = (C - 256 * G - R) / 65536
Range("C1").Offset(i, 0).Value = R
Range("D1").Offset(i, 0).Value = G
Range("E1").Offset(i, 0).Value = B
Range("F1").Offset(i, 0).Interior.Color = RGB(R, G, B)
Next i
End Sub

Think hard before you go this route - it might have unintended
consequences.

HTH

-John Coleman


John Coleman wrote:
You would need to change the color pallete. Go to Tools -Options -
Color and select the yellow square then modify it to get the color you
want. You have now lost yellow from the pallete. If you need yellow for
some other purposes, you can modify some other color (perhaps the one
you just replaced yellow with) to be yellow. You can do this in code -
but if it is only 1 or 2 colors you want to change - this works fine.

HTH

-John Coleman

Carrguy wrote:
Is there away to chenge the default fill colour from yellow to a different
colour




All times are GMT +1. The time now is 09:16 AM.

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