ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add Borderlines (https://www.excelbanter.com/excel-programming/416202-add-borderlines.html)

Curious[_6_]

Add Borderlines
 
I want to try to "box" the same customer by adding top border line and
bottom border line. I just want to improve readability for fun.

A long data list looks like

AAAAA
AAAAA
BBBBB
CCCCC
CCCCC
CCCCC

Any ideas or codes to share?

Thanks in advance

H. Z.

Gord Dibben

Add Borderlines
 
This will add a thick bottom border at each change of customer.

Sub Border_At_Change()
Dim LastRow As Long
Dim X As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False

For X = LastRow To 3 Step -1
If Cells(X, 1).Value < Cells(X - 1, 1).Value Then
If Cells(X, 1).Value < "" Then
If Cells(X - 1, 1).Value < "" Then
With Cells(X - 1, 1).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End If
End If
End If
Next X
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 27 Aug 2008 16:18:18 -0700 (PDT), Curious wrote:

I want to try to "box" the same customer by adding top border line and
bottom border line. I just want to improve readability for fun.

A long data list looks like

AAAAA
AAAAA
BBBBB
CCCCC
CCCCC
CCCCC

Any ideas or codes to share?

Thanks in advance

H. Z.




All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com