Colour number...

D

Darin Kramer

Howdie,

If a cell has been coloured, and I want to replace all the colours to a
new colour, I think I can do a find and replace for that colours
number... but where do u see its number? (not under properties...?)

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
D

DH

you need a custom function

function Mycolor(cell as range)
Mycolor=c.interior.colorindex
end function
 
B

Bob Phillips

Darin,

You cannot do a Find on a colour (either its number, or is colour id). What
you can do is get the colorindex of a particular cell with this code

Activecell.Interior.ColorIndex

To reset coloured cells in a selected range use

For Each cell In Selection
If cell.Interior.Colorindex = findColour Then
cell.Interior.Colorindex = replaceColour
End If
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Guest

hi,
in a blank workbook, paste the following code.
to call the vb window press alt+F11
Sub macGetColors()
' Macro written 2/10/02 by FSt1

Sheets("Sheet1").Select
Range("B2").Select
Set ci = Range("A1")
ci.Value = 1
Set c = Range("B2")
Do Until ci > 56
Set c2 = c.Offset(1, 0)
Set cnum = c.Offset(0, 1)
c.Interior.ColorIndex = ci.Value
c.Offset(0, 1) = ci.Value
ci.Value = ci.Value + 1
Set c = c2
c.Select
Loop

End Sub
It will create a list of all colors and their indexes.
good luck.
 

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

Similar Threads

Count Conditional Formatting Colours - Excel 2003 4
Colour listing.. 1
Data Form 1
Find and Replace alt enter 3
Custom Number sequences 0
Why no cell wrap...? 1
Sum IF 3
Summing N/A's 5

Top