I've set up vba to show different border line styles and border weights. See routine named "Borders". The result of this routine is shown in Sheet1.
The first set of borders shown in columns C-D, rows 4-8, are line style xlContinuous with three different Weights, xlThin, XlMedium and XlThick.
The second set of borders shown in columns F-G, rows 4-8, are line style xlDashDot with three different Weights, xlThin, XlMedium and XlThick.
The third set of borders shown in columns I-J, rows 4-8, are line style xlSlantDashDot with three different Weights, xlThin, XlMedium and XlThick.
The results do not make sense as shown in Sheet1 of the attached file, my textboxes point to the ones that do not result in what one would expect.
What is the difference between Border Weight and Border Line Style in vba?
In Excel, I see a selection of 14 border styles including "none". I was trying to figure out which one was which in vba.
-----
My next question after I get this resolved is to figure out the color of the lines. Is there a way to put in RGB values or a HEX code for line colors and fill colors?
Here's the code
======================================
CODE
Sub Borders()
Range("C1:D1").Borders(xlEdgeBottom).LineStyle = xlContinuous
Range("C1:D1").Borders(xlEdgeBottom).Weight = xlThin
Range("C1") = "Bottom Border Weight xlThin"
Range("C3:D3").Borders(xlEdgeBottom).LineStyle = xlContinuous
Range("C3:D3").Borders(xlEdgeBottom).Weight = xlMedium
Range("C3") = " Bottom Border Weight xlMedium"
Range("C5:D5").Borders(xlEdgeBottom).LineStyle = xlContinuous
Range("C5:D5").Borders(xlEdgeBottom).Weight = xlThick
Range("C5") = " Bottom Border Weight xThick"
' Let's do DashDot
Range("F1:G1").Borders(xlEdgeBottom).LineStyle = xlDashDot
Range("F1:G1").Borders(xlEdgeBottom).Weight = xlThin
Range("F1") = "Bottom Border Weight xlThin"
Range("F3:G3").Borders(xlEdgeBottom).LineStyle = xlDashDot
Range("F3:G3").Borders(xlEdgeBottom).Weight = xlMedium
Range("F3") = "Bottom Border Weight xlMedium"
Range("F5:G5").Borders(xlEdgeBottom).LineStyle = xlDashDot
Range("F5:G5").Borders(xlEdgeBottom).Weight = xlThick
Range("F5") = "Bottom Border Weight xlThick"
' Let's do SlantDashDot
Range("I1:J1").Borders(xlEdgeBottom).LineStyle = xlSlantDashDot
Range("I1:J1").Borders(xlEdgeBottom).Weight = xlThin
Range("I1") = "Bottom Border Weight xlThin"
Range("I3:J3").Borders(xlEdgeBottom).LineStyle = xlSlantDashDot
Range("I3:J3").Borders(xlEdgeBottom).Weight = xlMedium
Range("I3") = "Bottom Border Weight xlMedium"
Range("I5:J5").Borders(xlEdgeBottom).LineStyle = xlSlantDashDot
Range("I5:J5").Borders(xlEdgeBottom).Weight = xlThick
Range("I5") = "Bottom Border Weight xlThick"
Range("A1").Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Range("C2") = "Line Style xlContinuous"
Range("F2") = "Line Style xlDashDot"
Range("I2") = "Line Style xlSlantDashDot"
Columns("C:C").ColumnWidth = 24
Columns("F:F").ColumnWidth = 24
Columns("I:I").ColumnWidth = 24
Columns("E:E").ColumnWidth = 6
Columns("H:H").ColumnWidth = 6
End Sub
CODE