Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Sub extractdata()
  2. Dim x As Long, lastrow1, lastrow2
  3.  
  4. lastrow = Sheets("Perk").Range("A" & Rows.Count).End(xlUp).Row
  5.  
  6. Sheets("Housing").Range("A2:AW500").ClearContents
  7. Sheets("Registration").Range("A2:AW500").ClearContents
  8. For x = 2 To lastrow
  9. If Cells(x, 1) Like "y*" Or Cells(x, 1) Like "Y*" Then
  10. Worksheets("Perk").Cells(x, "A").EntireRow.Copy Destination:=Sheets("Registration").Range("A" & Rows.Count).End(xlUp).Offset(1)
  11. ElseIf Cells(x, 2) Like "y*" Or Cells(x, 2) Like "Y*" Then
  12. Worksheets("Perk").Cells(x, "A").EntireRow.Copy Destination:=Sheets("Housing").Range("A" & Rows.Count).End(xlUp).Offset(1)
  13. End If
  14. Next x
  15. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement