ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Place Thin Border around Cell (https://www.excelbanter.com/excel-programming/383858-place-thin-border-around-cell.html)

JMay

Place Thin Border around Cell
 
I only want to code a line which instructs VBA to
Place a thin border around a cell.

With Range("G2")
.Range("A1").Formula = "=SUBTOTAL(9,$G$5:$G$50)"
.Range("A1").Interior.ColorIndex = 6
.Range("A1").Font.Bold = True
.Range("A1").Style = "Comma"
<<<<<<<<<<<??????
End With

I did a Record Macro to get the code,, I only Clicked on the single icon
with the Full continuous line around the cell (top,left,right,& bottom)
and when I examined the code it was 15-20 lines << What is the SKINNY
of this auto produced code to produce a SIMPLE Border (All-Round type)?

TIA,

Jim May


Jason

Place Thin Border around Cell
 
I don't know that there is an easy way to complete all borders:

With Range("A1")
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
End With

Jason

"JMay" wrote:

I only want to code a line which instructs VBA to
Place a thin border around a cell.

With Range("G2")
.Range("A1").Formula = "=SUBTOTAL(9,$G$5:$G$50)"
.Range("A1").Interior.ColorIndex = 6
.Range("A1").Font.Bold = True
.Range("A1").Style = "Comma"
<<<<<<<<<<<??????
End With

I did a Record Macro to get the code,, I only Clicked on the single icon
with the Full continuous line around the cell (top,left,right,& bottom)
and when I examined the code it was 15-20 lines << What is the SKINNY
of this auto produced code to produce a SIMPLE Border (All-Round type)?

TIA,

Jim May



Jason

Place Thin Border around Cell
 
Please ignore last post...

.Range("A1").BorderAround Weight:=xlHairline

HTH

Jason

"JMay" wrote:

I only want to code a line which instructs VBA to
Place a thin border around a cell.

With Range("G2")
.Range("A1").Formula = "=SUBTOTAL(9,$G$5:$G$50)"
.Range("A1").Interior.ColorIndex = 6
.Range("A1").Font.Bold = True
.Range("A1").Style = "Comma"
<<<<<<<<<<<??????
End With

I did a Record Macro to get the code,, I only Clicked on the single icon
with the Full continuous line around the cell (top,left,right,& bottom)
and when I examined the code it was 15-20 lines << What is the SKINNY
of this auto produced code to produce a SIMPLE Border (All-Round type)?

TIA,

Jim May



Tom Ogilvy

Place Thin Border around Cell
 
With Range("G2")
.Range("A1").Formula = "=SUBTOTAL(9,$G$5:$G$50)"
.Range("A1").Interior.ColorIndex = 6
.Range("A1").Font.Bold = True
.Range("A1").Style = "Comma"
.Range("A1").BorderAround weight:=xlThin

End With


"JMay" wrote:

I only want to code a line which instructs VBA to
Place a thin border around a cell.

With Range("G2")
.Range("A1").Formula = "=SUBTOTAL(9,$G$5:$G$50)"
.Range("A1").Interior.ColorIndex = 6
.Range("A1").Font.Bold = True
.Range("A1").Style = "Comma"
<<<<<<<<<<<??????
End With

I did a Record Macro to get the code,, I only Clicked on the single icon
with the Full continuous line around the cell (top,left,right,& bottom)
and when I examined the code it was 15-20 lines << What is the SKINNY
of this auto produced code to produce a SIMPLE Border (All-Round type)?

TIA,

Jim May



JMay

Place Thin Border around Cell
 
Jason:
Tom Ogilvy recommended:

..Range("A1").BorderAround Weight:=xlThin

Works great!!

Jim May


"Jason" wrote in message
:

I don't know that there is an easy way to complete all borders:

With Range("A1")
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
End With

Jason

"JMay" wrote:

I only want to code a line which instructs VBA to
Place a thin border around a cell.

With Range("G2")
.Range("A1").Formula = "=SUBTOTAL(9,$G$5:$G$50)"
.Range("A1").Interior.ColorIndex = 6
.Range("A1").Font.Bold = True
.Range("A1").Style = "Comma"
<<<<<<<<<<<??????
End With

I did a Record Macro to get the code,, I only Clicked on the single icon
with the Full continuous line around the cell (top,left,right,& bottom)
and when I examined the code it was 15-20 lines << What is the SKINNY
of this auto produced code to produce a SIMPLE Border (All-Round type)?

TIA,

Jim May





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

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