Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Color Palette

Hi Katie,

Try this in a Workbook with a default palette, or at least don't customize
any of the colour index's listed in vIntclr or vPatClr arrays.

Sub myBlues()
Dim vIntclr
Dim vPat
Dim vPatClr
Dim vRGB
Dim sh As Shape

'cells with two colours & pattern shades

vIntclr = Array(17, 5, 5, 5, 5, 5, 5, 5, 5, 11, 1, 1, 1, 1)

vPat = Array(xlGray25, xlGray75, xlGray50, xlGray50, xlSolid, _
xlGray25, xlGray25, xlGray50, xlGray75, xlSolid, _
xlGray75, xlGray50, xlGray25, xlSolid)

vPatClr = Array(41, 17, 17, 41, -4105, 49, 11, _
11, 11, -4105, 11, 11, 11, -4105)

For i = 0 To 13
With Cells(i + 1, 2).Interior
.ColorIndex = vIntclr(i)
.Pattern = vPat(i)
.PatternColorIndex = vPatClr(i)
End With
Next

'compare with original colors

vRGB = Array(16747403, 16740721, 16734296, 16720932, 16714507, _
15728640, 14090240, 12386304, 10747904, 9109504, _
7405568, 5767168, 3997696, 720896, 10053222, 8421504)

For i = 1 To 14
With Cells(i, 1)
Set sh = ActiveSheet.Shapes.AddShape(1, _
.Left, .Top, .Width, .Height)
sh.Fill.ForeColor.RGB = vRGB(i - 1)
End With
Next

End Sub

This Sub formats cells in col-B with 2-colour + pattern shade combinations.
For comparison it also adds rectangles in col-A with the your original RGB
colours. Not a perfect match but not bad considering the limited palette and
using only default colours.

If you are not averse to customizing the palette then why not use the chart
colours.

Sub CustomBlues()
Dim i As Long
Dim vRGB
vRGB = Array(16747403, 16740721, 16734296, 16720932, 16714507, _
15728640, 14090240, 12386304, 10747904, 9109504, _
7405568, 5767168, 3997696, 720896, 10053222, 8421504)

For i = 0 To 13
ActiveWorkbook.Colors(i + 17) = vRGB(i)
Next

End Sub

The chart colours (colorindex's 17-32) are not visible in the drop down
palette but simply-
activecell.interior.colorindex = 17

The numbers in vRGB are long colour numbers, same as the RGB colours you
posted.

Regards,
Peter T


"Katie" wrote in message
oups.com...
Thanks Peter! I would really appreciate it if you were able to do it.
I also sent a copy to your gmail account. Here are the colors I need:
RGB (139, 139, 255)
RGB(113, 113, 255)
RGB(88, 88, 255)
RGB(36, 36, 255)
RGB(11, 11, 255)
RGB(0, 0, 240)
RGB(0, 0, 215)
RGB(0, 0, 189)
RGB(0, 0, 164)
RGB(0, 0, 139)
RGB(0, 0, 113)
RGB(0, 0, 88)
RGB(0, 0, 61)
RGB(0, 0, 11)



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
Color Palette JAD Excel Discussion (Misc queries) 0 November 30th 07 04:21 PM
Bring up Color Palette to select color pokdbz Excel Discussion (Misc queries) 4 August 6th 07 10:13 PM
Color Palette, color disappears Emil Excel Discussion (Misc queries) 3 November 29th 05 05:07 AM
VBA color palette Holanmeg Excel Programming 1 April 5th 05 09:27 AM
Changing color in color palette Dave Peterson Setting up and Configuration of Excel 0 December 12th 04 02:39 PM


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