|
发表于 2014-6-26 19:54
|
显示全部楼层
本楼为最佳答案
加一句代码就行- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Column <> 9 Then Exit Sub
- If Target.Row = 1 Then Exit Sub
- If Target.Count > 1 Then Exit Sub
- If Target = "" Then Target.Offset(, -8).Resize(, 8) = "": Exit Sub
- Dim arr
- arr = Sheets(2).Range("b2:h" & Sheets(2).[b65536].End(3).Row)
- Target.Offset(, -7).Resize(, 7) = Application.Index(arr, Target.Row + 1)
- Target.Offset(, -2) = "=E" & Target.Row & "*F" & Target.Row
- If Target.Row = 2 Then Cells(2, 1) = 1 Else Cells(Target.Row, 1) = Cells(Target.Row - 1, 1) + 1
- End Sub
复制代码 |
|