Afternoon
First post so please bear with me, and a bit of a beginner with VBA codes.
I'm trying to use a VBA code to identify all rows on a worksheet that contain the word 'No' in a certain column, then copy and paste these rows into a separate worksheet. This worked with the initial set of data on the master worksheet, but this data is getting added to every month, and now the code is not picking up all the rows required. I have 20 rows that show 'No' in the specified column, but only 10 of these are transferring to the new worksheet. It's not that the code isn't reading the newly added data, as some of this is showing correctly once the codes run.
Would really welcome any suggestions. This is what I'm using:
First post so please bear with me, and a bit of a beginner with VBA codes.
I'm trying to use a VBA code to identify all rows on a worksheet that contain the word 'No' in a certain column, then copy and paste these rows into a separate worksheet. This worked with the initial set of data on the master worksheet, but this data is getting added to every month, and now the code is not picking up all the rows required. I have 20 rows that show 'No' in the specified column, but only 10 of these are transferring to the new worksheet. It's not that the code isn't reading the newly added data, as some of this is showing correctly once the codes run.
Would really welcome any suggestions. This is what I'm using:
Code:
Private Sub CommandButton1_Click()
Worksheets("Failed QC's").Activate
Worksheets("Failed QC's").Range("A2:DF1500").ClearContents
a = Worksheets("Master form").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
Worksheets("Master form").Activate
If Worksheets("Master form").Cells(i, 92).Value = "No" Then
Worksheets("Master Form").Rows(i).Copy
Worksheets("Failed QC's").Activate
b = Worksheets("Failed QC's").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Failed QC's").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("Master form").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("Master form").Cells(1, 1).Select
End Sub
Last edited by a moderator: