Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. Sub ВставкаПоКоду()
  2. Set rngD = Application.InputBox(Prompt:="Выделите диапазон для " & Chr(13) _
  3. & "вставки строк", Title:="Ввод диапазона", Type:=8)
  4. rs = rngD.Item(1).Row
  5. rf = rngD.Item(rngD.Count).Row
  6. Application.ScreenUpdating = False
  7.  
  8. For i = rs To rf
  9. If Cells(i + 1, 2) <> Cells(i, 2) Then
  10. Rows(i + 1).Select
  11. Selection.Copy
  12. Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  13. ActiveSheet.Paste
  14. ActiveCell.Offset(, 22).Range("A1:H1").Select
  15. Selection.ClearContents
  16. Cells(i + 1, 4).Value = Cells(i + 1, 2)
  17. End If
  18.  
  19. Next i
  20.  
  21. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement