LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Conditional borders

The following procedure places borders conditionally as I want but it
does not stop when the Until condition is met. Instead it continues,
apparently to the bottom of the sheet, then gives an Error 400 which
is no help.
I think the problem is Range("C:C") but I don't know how to fix it.
Also, I would like to precede this in the same procedure with
something that would remove any existing borders. Any help would be
appreciated.

Public Sub DrawBorders()
Dim cell As Range
Dim numRows As Single

numRows = Selection.CurrentRegion.Rows.Count

Do
For Each cell In Range("C:C")
If cell.Offset(1, 0).Value < cell.Value Then
With Range(Cells(cell.Row, 1), Cells(cell.Row,
5)).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 1
End With
Else
End If
Next cell
Loop Until cell.Row = numRows
End Sub
 
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
conditional formatting borders PhilosophersSage Excel Discussion (Misc queries) 9 October 2nd 09 05:47 PM
Conditional Formatting Borders AJ Excel Discussion (Misc queries) 2 January 29th 09 05:53 PM
Conditional Format Borders clark-ee Excel Discussion (Misc queries) 1 October 26th 08 01:21 AM
Borders and conditional formating Patrick C. Simonds Excel Worksheet Functions 5 January 19th 08 06:03 AM
Conditional Borders? MarcoPolo Excel Discussion (Misc queries) 1 January 9th 07 03:39 PM


All times are GMT +1. The time now is 09:22 PM.

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

About Us

"It's about Microsoft Excel"