Hi all, I've tried a couple of different macros and I'm looking for best practice. I'm not too experienced with VBA but can normally follow code and adapt to my needs.
I am looking to copy all rows that contain 'Yes' in column 'P' sheet 'All' to sheet 'Incident'. So far everything I've used is very clunky and takes an age.
I would like to know best practice to allow this to be a smooth update.
The most basic code I've used is
Any help is appreciated. Thanks
I am looking to copy all rows that contain 'Yes' in column 'P' sheet 'All' to sheet 'Incident'. So far everything I've used is very clunky and takes an age.
I would like to know best practice to allow this to be a smooth update.
The most basic code I've used is
Code:
Sub Test()
For Each Cell In Sheets("All").Range("P:P")
If Cell.Value = "Yes" Then
matchRow = Cell.Row
Rows(matchRow & ":" & matchRow).Select
Selection.Copy
Sheets("Incidents").Select
ActiveSheet.Rows(matchRow).Select
ActiveSheet.Paste
Sheets("All").Select
End If
Next
End Sub
Any help is appreciated. Thanks