![最后一个单元格上的边框线,即使它是空单元格](https://linux22.com/image/1580985/%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E5%8D%95%E5%85%83%E6%A0%BC%E4%B8%8A%E7%9A%84%E8%BE%B9%E6%A1%86%E7%BA%BF%EF%BC%8C%E5%8D%B3%E4%BD%BF%E5%AE%83%E6%98%AF%E7%A9%BA%E5%8D%95%E5%85%83%E6%A0%BC.png)
在为每行到最后一个单元格创建边框线时,我遇到了一个问题。如果最后一个单元格有值,它会很好地工作。但是当最后一个单元格为空时,边框线就会停止。
这是我的代码
lastcell = Cells(Rows.Count, 19).End(xlUp).Address
lastrow = Cells(Rows.Count, 19).End(xlUp).Row
Rng = "A11:" & lastcell
Range(Rng).Select
With Selection
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlThin
.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlThin
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlThin
.VerticalAlignment = xlCenter
.WrapText = True
End With
我希望它仍然添加连续的边框线直到最后一个数据值,即使该行的最后一个单元格是空的。
谢谢。