Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I'm trying to set up a code - a loop whereby every time the value of cells (x,3) changes the cell pattern changes alternately from being shaded in grey and no colour. Not sure how to write it so that it does what i need. So for example if i had a s/s with John John Jim Jim Jim Fred It would colour john cells in Grey shading, Jim - no colour shading and Fred Grey Shading again. Sheets("Sheet1").Select x = 3 Do Until Cells(x, 3).Value = "" If Cells(x, 3).Value = Cells(x - 1, 3).Value and ...... Then ..... x = x + 1 Else if cells( Can anyone help? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Crauwf,
In Excel 2003 I have created this: Sub toggleFillColor() Dim x As Long Dim b As Boolean ' remove fillcolor Range("C:C").Interior.ColorIndex = xlNone x = 2 b = False Do Until IsEmpty(Cells(x, 3)) If Cells(x, 3).Value < Cells(x - 1, 3).Value Then b = Not b End If If b Then With Cells(x, 3).Interior .ColorIndex = 15 .Pattern = xlSolid End With End If x = x + 1 Loop End Sub HTH, Wouter |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, that's an absolutely immense code. Thanks for your help!!!
"RadarEye" wrote: Hi Crauwf, In Excel 2003 I have created this: Sub toggleFillColor() Dim x As Long Dim b As Boolean ' remove fillcolor Range("C:C").Interior.ColorIndex = xlNone x = 2 b = False Do Until IsEmpty(Cells(x, 3)) If Cells(x, 3).Value < Cells(x - 1, 3).Value Then b = Not b End If If b Then With Cells(x, 3).Interior .ColorIndex = 15 .Pattern = xlSolid End With End If x = x + 1 Loop End Sub HTH, Wouter |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Looping Format | Excel Worksheet Functions | |||
About my looping | Excel Programming | |||
Looping | Excel Programming | |||
Looping | Excel Programming | |||
Looping | Excel Programming |