Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. Name DOC STATUS
  2. John ID OK
  3. John ADRESS Incomplete
  4. John SURNAME Missing
  5. Lara ID OK
  6. Lara ADRESS Missing
  7. Lara SURNAME Missing
  8. Rony ID OK
  9. Rony ADRESS OK
  10. Rony SURNAME OK
  11.  
  12. Option Explicit
  13.  
  14. Sub GroupEveryNRows()
  15.  
  16. Dim i As Long, LastRow As Long
  17.  
  18. ' modify "Sheet1" to your sheet's name
  19. With Sheets("Sheet1")
  20. ' find last row with data in Column A
  21. LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
  22.  
  23. ' loop from 2nd row till last row with data (assuming the first row has headers)
  24. For i = 2 To LastRow Step 3
  25. Range("A" & i + 1 & ":A" & i + 2).Rows.Group
  26. Next i
  27. End With
  28.  
  29. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement