View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert McCurdy Robert McCurdy is offline
external usenet poster
 
Posts: 102
Default An interesting one for all you experts...

Select the range and run this.

Sub NumbCol()
Dim c As Range
For Each c In Selection
c.Value = c.Interior.ColorIndex
Next c
End Sub


And to see all the colours with their colorindex

Sub ShowColor()
Dim c As Range, i As Integer
'select a cell in an empty column
Set c = ActiveCell
For i = 0 To 56
c.Offset(i, 0).Interior.ColorIndex = i
c.Offset(i, 1).Value = i
Next
End Sub


Regards Robert

"EV" wrote in message ...
Hi All,

This might be an interesting one for the experts out there...

I have an Excel sheet with 50 columns and 50 rows. Each cell is colour coded
(background colour). i.e. White, Black, Red etc there is no data in the
cells...

I need to go through each cell on every row and column and place a number in
the cell according to which background colour the cell has... i.e.

White = 0
Black = 1
Red = 2
etc...

Is somebody can help me on this it would be very much appreciated, else I'm
gonna have to go and type all this into a table by hand... <violins :(
</violins)

Thanks again,
Andy





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 21/02/2004