Ading color to difrent cells

  • Thread starter vladislavg - ExcelForums.com
  • Start date
V

vladislavg - ExcelForums.com

Hi everybody
I have a column that contains diferent time intervals and I want t
make a macro or VBA to give to each diferent time interval diferen
color

Exampl
18:00-18:1
18:00-18:1
18:10-18:2

The "18:00-18:10" should be in one colo
The "18:10-18:20" should be in another color

thank
 
F

Frank Stone

Hi,
activecell.interior.colorindex = 5 'red

copy this code into an blank xl file to find all of the
color indexes
Sub macGetColors()

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
 
Top