The dashed lines suggest that the LineStyle is not set to xlContinuous, which is necessary for a solid line. Also, xlHairline is typically the thinnest line style available, but it may not match the default border style in some cases. Instead, you should use xlThin which is the standard border weight for cell borders in Excel.
Here’s the VBA code that should apply a continuous, thin border to each cell in column C, which is usually the default border style:
' Set the interior color as needed
.Interior.Color = RGB(255, 255, 255) ' White color for example
' Set all borders to thin and continuous, which is the default style
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeLeft).Color = RGB(0, 0, 0)
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeTop).Color = RGB(0, 0, 0)
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeBottom).Color = RGB(0, 0, 0)
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlThin
.Borders(xlEdgeRight).Color = RGB(0, 0, 0)
.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlThin
.Borders(xlInsideVertical).Color = RGB(0, 0, 0)
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlThin
.Borders(xlInsideHorizontal).Color = RGB(0, 0, 0)
This macro sets a thin, solid border for the left, right, top, and bottom edges of the column, as well as for the inside vertical and horizontal borders, effectively outlining each cell. The RGB(0, 0, 0) sets the border color to black, and xlThin applies the standard thin border weight.
Please run this code in your VBA editor, and it should give you the continuous, thin borders that are the default style in Excel.