Guest User

Untitled

a guest
Oct 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. Значение
  2. пустая ячейка
  3. значение
  4. пустая ячейка
  5.  
  6. Sub InsertRows()
  7. Dim rRng As Range
  8. Dim lStart As Long, lRw As Long, lClmn As Long
  9. Dim i As Long
  10. Set rRng = Selection: lClmn = rRng.Column
  11. lStart = rRng.Row + 1: lRw = rRng.Rows.Count + rRng.Row
  12. Application.ScreenUpdating = False
  13.  
  14. For i = lRw To lStart Step -1
  15. If rRng(i, 1).Value <> "" Then
  16. ' Rows(i).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  17. Cells(i, lClmn).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  18. End If
  19. Next i
  20.  
  21. Application.ScreenUpdating = True
  22. Set rRng = Nothing
  23. End Sub
Add Comment
Please, Sign In to add comment