Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. Sub test()
  2.  
  3. Worksheets(2).Activate
  4.  
  5. lastrow = Range("A3").End(xlDown).Row
  6.  
  7. For i = 3 To lastrow
  8.  
  9. If Cells(i, 8) <> "" Then
  10. Range(Cells(i + 1, 8), Cells(i + 1, 9)).Select
  11. Selection.Insert Shift:=xlDown
  12. Cells(i + 1, 9).Value = Cells(i, 2).Value
  13. Else
  14. Cells(i + 1, 9).Value = Cells(i, 2).Value
  15. End If
  16.  
  17. Next i
  18.  
  19. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement