ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Border around range working -Border for cells within range not wor (https://www.excelbanter.com/excel-programming/399870-border-around-range-working-border-cells-within-range-not-wor.html)

Gwen

Border around range working -Border for cells within range not wor
 
Hi,
Please assist.

I want a thick border around range and a5:l8
I want thin borders around cells in range from a5 to the end of range.

The below code gives me the thick borders I want not the cells within the
range.

Set rngAL8 = Range(Cells(Rows.Count, "A").End(xlUp), Range("l5"))

With rngAL8
'.Borders.LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlHairline

.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlHairline

.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlHairline

.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlHairline
End With


Set rng = Range(Cells(Rows.Count, "A").End(xlUp), Range("l1"))
With rng
..Borders(xlInsideHorizontal).LineStyle = xlNone
..Borders(xlEdgeLeft).Weight = xlThick
..Borders(xlEdgeRight).Weight = xlThick
..Borders(xlEdgeTop).Weight = xlThick
..Borders(xlEdgeBottom).Weight = xlThick
End With

Set rnga5l7 = Range("A5:L7")
With rnga5l7
..Borders(xlInsideHorizontal).LineStyle = xlNone
..Borders(xlEdgeLeft).Weight = xlThick
..Borders(xlEdgeRight).Weight = xlThick
..Borders(xlEdgeTop).Weight = xlThick
..Borders(xlEdgeBottom).Weight = xlThick
End With

Thanks

Bernie Deitrick

Border around range working -Border for cells within range not wor
 
? maybe remove these 2 lines

Borders(xlInsideHorizontal).LineStyle = xlNone


HTH,
Bernie
MS Excel MVP


"Gwen" wrote in message
...
Hi,
Please assist.

I want a thick border around range and a5:l8
I want thin borders around cells in range from a5 to the end of range.

The below code gives me the thick borders I want not the cells within the
range.

Set rngAL8 = Range(Cells(Rows.Count, "A").End(xlUp), Range("l5"))

With rngAL8
'.Borders.LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlHairline

.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlHairline

.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlHairline

.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlHairline
End With


Set rng = Range(Cells(Rows.Count, "A").End(xlUp), Range("l1"))
With rng
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Borders(xlEdgeLeft).Weight = xlThick
.Borders(xlEdgeRight).Weight = xlThick
.Borders(xlEdgeTop).Weight = xlThick
.Borders(xlEdgeBottom).Weight = xlThick
End With

Set rnga5l7 = Range("A5:L7")
With rnga5l7
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Borders(xlEdgeLeft).Weight = xlThick
.Borders(xlEdgeRight).Weight = xlThick
.Borders(xlEdgeTop).Weight = xlThick
.Borders(xlEdgeBottom).Weight = xlThick
End With

Thanks




JLGWhiz

Border around range working -Border for cells within range not wor
 
It seemed to work OK just using the xlInsideHorizontal or xlInsideVertical.
I commented out the others.

With RngAL8
'.Borders.LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlThick

'.Borders(xlEdgeBottom).LineStyle = xlContinuous
'.Borders(xlEdgeBottom).Weight = xlThick

'.Borders(xlEdgeRight).LineStyle = xlContinuous
'.Borders(xlEdgeRight).Weight = xlThick

.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlThick

"Gwen" wrote:

Hi,
Please assist.

I want a thick border around range and a5:l8
I want thin borders around cells in range from a5 to the end of range.

The below code gives me the thick borders I want not the cells within the
range.

Set rngAL8 = Range(Cells(Rows.Count, "A").End(xlUp), Range("l5"))

With rngAL8
'.Borders.LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlHairline

.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlHairline

.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlHairline

.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlHairline
End With


Set rng = Range(Cells(Rows.Count, "A").End(xlUp), Range("l1"))
With rng
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Borders(xlEdgeLeft).Weight = xlThick
.Borders(xlEdgeRight).Weight = xlThick
.Borders(xlEdgeTop).Weight = xlThick
.Borders(xlEdgeBottom).Weight = xlThick
End With

Set rnga5l7 = Range("A5:L7")
With rnga5l7
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Borders(xlEdgeLeft).Weight = xlThick
.Borders(xlEdgeRight).Weight = xlThick
.Borders(xlEdgeTop).Weight = xlThick
.Borders(xlEdgeBottom).Weight = xlThick
End With

Thanks


Gwen

Border around range working -Border for cells within range not
 
Thanks for your help.
Unfortunately I am not getting the top/bottom border lines

"JLGWhiz" wrote:

It seemed to work OK just using the xlInsideHorizontal or xlInsideVertical.
I commented out the others.

With RngAL8
'.Borders.LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlThick

'.Borders(xlEdgeBottom).LineStyle = xlContinuous
'.Borders(xlEdgeBottom).Weight = xlThick

'.Borders(xlEdgeRight).LineStyle = xlContinuous
'.Borders(xlEdgeRight).Weight = xlThick

.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlThick

"Gwen" wrote:

Hi,
Please assist.

I want a thick border around range and a5:l8
I want thin borders around cells in range from a5 to the end of range.

The below code gives me the thick borders I want not the cells within the
range.

Set rngAL8 = Range(Cells(Rows.Count, "A").End(xlUp), Range("l5"))

With rngAL8
'.Borders.LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlHairline

.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlHairline

.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlHairline

.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlHairline
End With


Set rng = Range(Cells(Rows.Count, "A").End(xlUp), Range("l1"))
With rng
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Borders(xlEdgeLeft).Weight = xlThick
.Borders(xlEdgeRight).Weight = xlThick
.Borders(xlEdgeTop).Weight = xlThick
.Borders(xlEdgeBottom).Weight = xlThick
End With

Set rnga5l7 = Range("A5:L7")
With rnga5l7
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Borders(xlEdgeLeft).Weight = xlThick
.Borders(xlEdgeRight).Weight = xlThick
.Borders(xlEdgeTop).Weight = xlThick
.Borders(xlEdgeBottom).Weight = xlThick
End With

Thanks



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

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