|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub Worksheet_Activate()
Dim ar, n%
ar = Worksheets("数据源").UsedRange
n = Application.WorksheetFunction.CountIf(Worksheets("数据源").Columns(4), "合计")
For i = UBound(ar) To 2 Step -1
If ar(i, 4) = "合计" Then
Worksheets("首页").[c4] = ar(i, 4) & " 出现的次数为: " & n
Worksheets("首页").[d4] = "最后一次借方:" & ar(i, 6)
Worksheets("首页").[e4] = "最后一次贷方:" & ar(i, 7)
Exit For
End If
Next
Worksheets("首页").Columns(3).AutoFit
Worksheets("首页").Columns(4).AutoFit
Worksheets("首页").Columns(5).AutoFit
End Sub
|
|