custom function color

A

art

Hello:

I would like to make a custon funtion that will make the color of the cell
one number different then the selected range. Lets say the formula will work
something like this in cell b1: =MyColor(A1) and if the RGB color in cell a1
is red 10 green 0 yellow 0 then cell b1 should be red 11 green 0 yellow 0.

Please help.

Thanks
 
A

art

So how about a vba modul that will change the colors of the selected cells to
one diffedrent rgb color by a scroll bar? Like range a1:E50 which all contain
certain colors in each cell, by scrolling the scroll bar will change the
color from each to a diiferent color like a1 is r = 10 g = 0 y = 0 then r=11
g=0 y=0.
 
C

Chip Pearson

Here's some basic code you can adapt for your specific needs:

Sub IncrementColors()
Dim R As Range
Dim C As Long
For Each R In Range("A1:A5")
If R.Interior.ColorIndex > 0 Then
C = (R.Interior.ColorIndex + 1) Mod 57
R.Interior.ColorIndex = C
End If
Next R
End Sub


This changes the background fill color "up" one value in the built-in
color pallet, "rolling over" from 56 back to 1. R.Interior.ColorIndex
changes the background fill. Use R.Font.ColorIndex to change font
color.

The code only changes that have a specific color assigned to them.
(ColorIndex > 0). It doesn't change the default background or font
color (ColorIndex < 0).

See http://www.cpearson.com/Excel/Colors.aspx for lots more info on
working with colors.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top