james potter
New Member
- Joined
- Aug 15, 2005
- Messages
- 45
Hello,
I would like to make the colorindex number random but I have a problem with the code. Maybe someone can help me?
I have tried it with for ... next argument but that keeps running until the last number. With no use of for ... next argument if works fine but cell color and indexnumber stays the same.
I would like to make the colorindex number random but I have a problem with the code. Maybe someone can help me?
I have tried it with for ... next argument but that keeps running until the last number. With no use of for ... next argument if works fine but cell color and indexnumber stays the same.
Code:
Sub looping2()
Range("a2").Select
'for i = 15 to 50
Do
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
Selection.Interior.ColorIndex = ActiveCell.Offset(-1, 0).Interior.ColorIndex
Else
Selection.Interior.ColorIndex = 13 'i
End If
ActiveCell.Offset(1, 0).Select
'Next i
Loop Until IsEmpty(ActiveCell)
End Sub