急!vba中控制Excel单元格边框线
我用vba在Excel中根据变量划出相应范围内单元格的下面的边框线,代码如下:
With xlsheet.Range("B" & row & ":W" & row).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
但是运行结果是在相应的位置上下边框线却始终没有被画上,可是若将其中的变量指定为具体的行号后,运行结果却是正确的,如下
With xlsheet.Range("B25:W25").Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
不知这是为什么,有什么方法可以实现动态的给指定范围的单元格画下边框线,非常感谢各位高手的赐教,谢谢!!!