Guest User

Untitled

a guest
Feb 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Sub TESTexample()
  2. Dim lastrow As Integer
  3. lastrow = Cells(Rows.Count, 1).End(xlUp).Row
  4. Dim lastcol As Integer
  5. lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
  6. Dim r As Integer
  7. Dim c As Integer
  8. For r = lastrow To 2 Step -1
  9. For c = lastcol To 3 Step -1If Cells(r, c) <> "" Then
  10. Rows(r + 1).Insert
  11. Cells(r + 1, 1) = Cells(r, 1)
  12. Cells(r + 1, 2) = Cells(r, c)
  13. Cells(r, c).Clear
  14. Else: Rows(r).Delete
  15. End If
  16. Next
  17. Next
  18. End Sub
Add Comment
Please, Sign In to add comment