View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default creating rows of colored cells from adjacent numbers

Roger,

Select the cells with the numbers, and run this

Sub RogerGantt()
Dim i As Integer
Dim t As Integer
Dim myCell As Range

t = 0
For Each myCell In Selection
For i = 1 To myCell.Value
t = t + 1
myCell.Offset(0, t).Interior.ColorIndex = 3
Next i
Next myCell

End Sub

HTH,
Bernie
MS Excel MVP


"Roger on Excel" wrote in message
...
Hi ,

I have a column of numbers :

3
2
4

I want to make the corresponding number of adjacent cells appeared colored.
For example next to the "3" would be three red cells, next to "2", two red
cells, etc.

However I would like the colored cells to start after the previous columns
colored cells so that a Gantt chart effect is provided.

Can anyone help?

Thanks,

Roger