Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default How Write for RGB palette?

I have the following procedure for changing background colors of cells based
upon whatever percentage a user types in, however, the standard colors to
pick are too dark and I would like some lighter colors from the RGB palette.
Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

Multiple Select Case Statements.... followed by....

ElseIf Not (Intersect(Target, Me.Range("SPM12mo")) Is Nothing) Then
Select Case UCase(Target.Value) 'Converts entry in cell to Uppercase
Case Is = "RED": icolor = 3
Case Is = "YLO": icolor = 6
Case Is = "BRZ": icolor = 53
Case Is = "SVR": icolor = 16
Case Is = "GLD": icolor = 44
Case Else: icolor = xlNone
End Select
Target.Interior.ColorIndex = icolor

End If
End Sub

Is there a way to rewrite this to draw from the RGB palette so I can get the
shade of color that I want to use. Mainly I need to use it for readability.
Thank you.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How Write for RGB palette?

What I usually do is record a new macro and manually set the colors until I
get the values I like. Then paste the values from the recorded macro into my
code.

Record macro by using worksheet menu Tools - Macro - Record New Macro.

"Walter" wrote:

I have the following procedure for changing background colors of cells based
upon whatever percentage a user types in, however, the standard colors to
pick are too dark and I would like some lighter colors from the RGB palette.
Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

Multiple Select Case Statements.... followed by....

ElseIf Not (Intersect(Target, Me.Range("SPM12mo")) Is Nothing) Then
Select Case UCase(Target.Value) 'Converts entry in cell to Uppercase
Case Is = "RED": icolor = 3
Case Is = "YLO": icolor = 6
Case Is = "BRZ": icolor = 53
Case Is = "SVR": icolor = 16
Case Is = "GLD": icolor = 44
Case Else: icolor = xlNone
End Select
Target.Interior.ColorIndex = icolor

End If
End Sub

Is there a way to rewrite this to draw from the RGB palette so I can get the
shade of color that I want to use. Mainly I need to use it for readability.
Thank you.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default How Write for RGB palette?

Hi Walter

presuming you know the RGB colours you want to use change you icolor numbers
to RGB

....Case Is = "RED": icolor = RGB(200, 200, 200)

and then change the ColorIndex to just Color

....Target.Interior.Color = icolor

HTH

Trevor Williams

"Walter" wrote:

I have the following procedure for changing background colors of cells based
upon whatever percentage a user types in, however, the standard colors to
pick are too dark and I would like some lighter colors from the RGB palette.
Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

Multiple Select Case Statements.... followed by....

ElseIf Not (Intersect(Target, Me.Range("SPM12mo")) Is Nothing) Then
Select Case UCase(Target.Value) 'Converts entry in cell to Uppercase
Case Is = "RED": icolor = 3
Case Is = "YLO": icolor = 6
Case Is = "BRZ": icolor = 53
Case Is = "SVR": icolor = 16
Case Is = "GLD": icolor = 44
Case Else: icolor = xlNone
End Select
Target.Interior.ColorIndex = icolor

End If
End Sub

Is there a way to rewrite this to draw from the RGB palette so I can get the
shade of color that I want to use. Mainly I need to use it for readability.
Thank you.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How Write for RGB palette?

There is no RGB color palatte as such. You have to build your own by
assigning the RGB values to variables and then calling those variables when
needed.

expl:

colVar1 = RGB(255, 200, 150)
colVar2 = RGB(200, 150, 255)
colVar3 = RGB(168, 247, 145)
If myRange = Yes Then
myRange.Interior.Color = colVar2
Else
myRange.Interior.Color = colVar3
End If

"Walter" wrote:

I have the following procedure for changing background colors of cells based
upon whatever percentage a user types in, however, the standard colors to
pick are too dark and I would like some lighter colors from the RGB palette.
Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

Multiple Select Case Statements.... followed by....

ElseIf Not (Intersect(Target, Me.Range("SPM12mo")) Is Nothing) Then
Select Case UCase(Target.Value) 'Converts entry in cell to Uppercase
Case Is = "RED": icolor = 3
Case Is = "YLO": icolor = 6
Case Is = "BRZ": icolor = 53
Case Is = "SVR": icolor = 16
Case Is = "GLD": icolor = 44
Case Else: icolor = xlNone
End Select
Target.Interior.ColorIndex = icolor

End If
End Sub

Is there a way to rewrite this to draw from the RGB palette so I can get the
shade of color that I want to use. Mainly I need to use it for readability.
Thank you.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How Write for RGB palette?

If you are looking for some kind of color scheme for different RGB code
structure, then try this site. It is a quite lengthy chart but provides a
wide variety of color reseults for RGB combinations.

http://rgbchart.com/

"Walter" wrote:

I have the following procedure for changing background colors of cells based
upon whatever percentage a user types in, however, the standard colors to
pick are too dark and I would like some lighter colors from the RGB palette.
Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

Multiple Select Case Statements.... followed by....

ElseIf Not (Intersect(Target, Me.Range("SPM12mo")) Is Nothing) Then
Select Case UCase(Target.Value) 'Converts entry in cell to Uppercase
Case Is = "RED": icolor = 3
Case Is = "YLO": icolor = 6
Case Is = "BRZ": icolor = 53
Case Is = "SVR": icolor = 16
Case Is = "GLD": icolor = 44
Case Else: icolor = xlNone
End Select
Target.Interior.ColorIndex = icolor

End If
End Sub

Is there a way to rewrite this to draw from the RGB palette so I can get the
shade of color that I want to use. Mainly I need to use it for readability.
Thank you.


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) 1 November 19th 07 02:26 AM
Color Palette Beep Beep Excel Programming 2 June 15th 07 08:28 PM
Formula palette. STIG Excel Programming 3 September 29th 06 01:17 PM
Color Palette Katie[_5_] Excel Programming 7 January 9th 06 06:18 PM
Formula Palette Will[_7_] Excel Programming 1 February 6th 04 02:24 PM


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