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: 116
Default Edge Sequence Color

Could some bush up this vba? I need to color the edge of
the first cell. in a sequence of cells.

A B C D E
1 99 2 3 4 13
2 6 12 1 2 23

In the above example in row 1 -- 2&3&4 are in sequence thereby Cell B1
would have a yellow left hand edge colored.

Similarly, in row 2 -- 1&2 are in sequence thereby Cell C2
would have a yellow left hand edge colored

Sub ColorFirstEdgeSeq()
Dim x As Range
With Sheets("Sheet1")
Set x = .Range(.Range("A1"), .Range("E2"))
End With

For Each C In x
If C.Value = (C.Offset(0, 1).Value - 1) Then
Range(C, C.Offset(0, 1)).Select
With ActiveCell.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 36
End With

End If
Next

Range("A1").Select
End Sub

With Thanks
Steve


 
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
how do I print edge to edge with absolutely NO margins Girl4chuckie Excel Worksheet Functions 3 April 3rd 23 07:41 PM
How do you get rid of the outside edge with the numbers and lette. Illogical Lucy[_2_] Excel Discussion (Misc queries) 1 April 30th 10 03:57 PM
How do I bring text to the edge of the page? blcottle Excel Discussion (Misc queries) 1 November 29th 07 12:17 AM
Printing cannot go close to edge of paper Angus Excel Discussion (Misc queries) 7 May 8th 06 04:25 PM
How to copy "edge" formatting to other cells. Sam Excel Discussion (Misc queries) 2 July 21st 05 01:23 PM


All times are GMT +1. The time now is 12:24 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"