
AI
打开工程管理器,或同来自时按下ALT+F11 插入模块 粘贴代码后运行 代码: Sub s() 京严实单Application.CutCopyMode = False With Sheet1 For i = .[A65536].End(xlUp).Row To 2 Step -1 If .Cells(i, 3) 1 Then .Rows(i + 1 & : & i + .Cells(i, 3) - 1).Insert Shift:=xlDown '批数量大于1,插入批数量空白行 .Range(.Cells(i, 1), .Cells(i, 12)).Copy '复制
AI:Li .Range(A & i + 1 & :L & i + .Cells(i, 3) - 1).Select '选取插入的空白行 .Paste '贴上复制数据 End If Next i .Range(Cells(2, 6), Cells(.[A65536].End(xlUp).Row, 6)) = 1 '现数量填1 .Cells(1, 1).Select End With Application.CutCopyMode = True End Sub