|
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Count <> [1:1].Columns.Count Then Exit Sub
- If Application.CountIf(Target.EntireRow, "") <> [1:1].Columns.Count Then Exit Sub
- If Target.Rows.Count <> 1 Then Exit Sub
- If Target(1).Row = 1 Then Exit Sub
- If Application.CountIf(Target.Offset(-1).EntireRow, "") = [1:1].Columns.Count Then Exit Sub
- Dim ar(), i
- ReDim ar(1 To Cells(Target.Offset(-1)(1).Row, Cells.Columns.Count).End(1).Column)
- For i = 1 To UBound(ar)
- ar(i) = Target.Offset(-1)(i).Formula
- Next i
- Target(1).Resize(, UBound(ar)) = ar
- End Sub
复制代码
|
|