I am trying to create borders in an excel spreadsheet programaticaly using VBA. I am getting an object error on line 2 Selection.Borde rs(xlDiagonalDo wn...
This is my code:
This is my code:
Code:
xlWS.Range("F2:J410").Select Selection.Borders(xlDiagonalDown).LineStyle = xlContinuous Selection.Borders(xlDiagonalUp).LineStyle = xlContinuous With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = 0 End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .ColorIndex = 0 End With
Comment