|
发表于 2017-3-25 17:07
|
显示全部楼层
本楼为最佳答案
成本价没做,很简单的,你自己练下手吧。
- Private Sub Worksheet_Change(ByVal T As Range)
- Dim rng As Range, r&, i&, n#
- If T.Address = "$P$1" Then
- With Sheets(1)
- r = .Columns(2).Find(T.Value).Row
- For i = r To .Rows.Count
- If .Cells(i, 2) <> "" Then Exit For
- n = n + .Cells(i, 8) + .Cells(i, 15)
- Next i
- i = i - 1
- Set rng = Union(.Range(.Cells(r, 2), .Cells(i, 2)), .Range(.Cells(r, 4), .Cells(i, 9)), .Range(.Cells(r, 11), .Cells(i, 16)))
- End With
- If [a65536].End(3).Row > 4 Then [a1].CurrentRegion.Offset(4).Clear
- rng.Copy [a5]
- End If
- End Sub
复制代码 |
|