Kan iemand mij vertellen of het mogelijk om mbv minder VBA-code randen om een bereik te krijgen?
Standaard krijg je vanuit de macro-recorder iets als :
Maar kan dit niet met iets als :
Is volgens mij nét iets overzichtelijker, maar krijg nu een foutmelding. Moet dit écht allemaal helemaal apart per border?
Bij voorbaat dank voor je moeite!
Standaard krijg je vanuit de macro-recorder iets als :
Code:
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Maar kan dit niet met iets als :
Code:
With Selection.Borders(xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight, xlInsideVertical,xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Is volgens mij nét iets overzichtelijker, maar krijg nu een foutmelding. Moet dit écht allemaal helemaal apart per border?
Bij voorbaat dank voor je moeite!