所以我想了这么多:
Dim myLastRow As Long
'Find last row in column A
myLastRow = Cells(Rows.Count, "A").End(xlUp).Row
' Insert count after last cell in column A
Cells(myLastRow + 1, "A").Formula = "=COUNTA(A2:A" & myLastRow & ")"
这会计算一个列并将总数放在底部。但是如何在总数之前的最后一行加下划线?
答案 0 :(得分:0)
这应该可以解决问题。
Dim myLastRow As Long
'Find last row in column A
myLastRow = Cells(Rows.Count, "A").End(xlUp).Row
'Insert count after last cell in column A
Cells(myLastRow + 1, "A").Formula = "=COUNTA(A2:A" & myLastRow & ")"
With Cells(myLastRow + 1, "A").Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With