|
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
Range("A1:M4000").Interior.ColorIndex = 0
n = Target.Row
Range(Cells(n, 1), Cells(n, 13)).Interior.ColorIndex = 33
'★★★汇总。
arr = Range([e7], Cells(Rows.Count, 5).End(xlUp))
ar = Range([f7], Cells(Rows.Count, 6).End(xlUp))
a = Range([g7], Cells(Rows.Count, 7).End(xlUp))
a6 = Range([H7], Cells(Rows.Count, 8).End(xlUp))
a2 = Range([d7], Cells(Rows.Count, 4).End(xlUp))
a3 = Range([k7], Cells(Rows.Count, 11).End(xlUp))
a4 = Range([l7], Cells(Rows.Count, 12).End(xlUp))
a5 = Range([m7], Cells(Rows.Count, 13).End(xlUp))
[e4] = WorksheetFunction.Sum(arr)
[f4] = WorksheetFunction.Sum(ar)
[g4] = WorksheetFunction.Sum(a)
[h4] = WorksheetFunction.Sum(a6)
[d4] = WorksheetFunction.Sum(a2)
[k4] = WorksheetFunction.Sum(a3)
[l4] = WorksheetFunction.Sum(a4)
[m4] = WorksheetFunction.Sum(a5)
'★★★ 自动添加网格线。
n = n + 1 'n=n+1 n = n + 1 'n=n+1
[a7].Resize(n - 6, 13).Borders.LineStyle = 1
End Sub '子程序结束
|
|