PC Review


Reply
Thread Tools Rate Thread

Conditional Formatting in a For Each Worksheet Loop

 
 
RyanH
Guest
Posts: n/a
 
      16th Jan 2008
I currently have 1 conditional format on all worksheets. I want to add a 2nd
conditional format to all worksheets. This loop does not seem to work. Does
anyone have any ideas why?

Sub CFormat ()

Dim wks As Worksheet

For Each wks in Worksheets
'adds a bottom line to every 5th rows
wks.UsedRange.FormatConditions.Add Type:=xlExpression,
Formula2:="=MOD(ROW(),5)=0"
With wks.UsedRange.FormatConditions(2).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Next wks

End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop/Conditional formatting 3 cells above - More than 3 conditions =?Utf-8?B?UmFqdWxh?= Microsoft Excel Programming 4 11th Oct 2006 11:20 AM
Subject - Loop/Conditional formatting 3 cells above. - more than 3 =?Utf-8?B?UmFqdWxh?= Microsoft Excel Programming 1 9th Oct 2006 05:56 PM
Conditional Formatting in For:Next loop - won't work!!! Cumberland Microsoft Excel Programming 3 21st Jun 2006 01:03 PM
Conditional Formatting in a Loop =?Utf-8?B?bG9zdCEh?= Microsoft Excel Programming 8 6th Oct 2004 02:43 PM
conditional formatting & a loop =?Utf-8?B?bG9zdCEh?= Microsoft Excel Programming 1 27th Sep 2004 08:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:37 AM.