Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Format Looping

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Format Looping

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Format Looping

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping Format Totoshi Excel Worksheet Functions 3 May 17th 10 06:07 PM
About my looping jonathan Excel Programming 3 July 31st 07 02:48 PM
Looping Bob Phillips Excel Programming 0 January 11th 07 04:12 PM
Looping Embalmer Excel Programming 1 January 8th 06 11:51 PM
Looping [email protected] Excel Programming 0 October 31st 03 07:47 PM


All times are GMT +1. The time now is 02:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"