2016-08-09 97 views
1

我想设置这样的边框。如何设置此范围边界?

what I want to achieve

我的代码不能像在图片执行的效果,中间是空的(没有边界)与该边界的厚度。

范围是A4:B30

With Range(Cells(6, 1), Cells(row, 2))' row is second last row 
    .Borders.LineStyle = xlContinuous 
    .Weight = xlHairline 
End With 

如何获得我的范围内部细胞之间的薄中间边界?

回答

2

对于美观的改变,总是尝试录制宏并阅读代码。这是最好的方法。 :)

Sub testBorders() 

With Range(Cells(6, 1), Cells(30, 2)).Borders(xlEdgeRight) 
'/(xlEdgeRight) sets the border only to right most cells 
.LineStyle = xlContinuous 
.Weight = xlMedium '/ as per your pic you are looking for medium weight. 
End With 

End Sub 
+0

还缺三行。顶部,左侧,底部(总体上线) – evabb

+2

伟大..现在你知道该怎么做,以及如何做到这一点。 :)开裂......如果卡住使用宏记录器。 – cyboashu

+0

我添加3个三个添加顶部,左侧,底部 – evabb