我想在总线的底部添加边框线和底部的边框线Excel VBA - 仅在顶部和底部添加边框的总线
例如,我有第2到第3行和第3-4列的数据,然后我在第5行添加了一条总和线2-3。总和线
我想在第5行的顶部和底部添加一条边界线,只能到第4列。
我可以使用变量LastRow + 2(注意在最后一行数据和总行之间有一个空行)和LastColumn如何在范围(“A5:D5”)中。选择,因为每次都会变化?
我当前的代码:
Range("A5:D5").Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With