Hi, I have a worksheet (Sheet1) with data in each row. I want the data in Sheet1 to be transferred to sheet2 if column 10 (J) equals "Yes", and once transferred/copied to sheet2, the data is deleted from sheet1 and the all the blank rows are deleted. Column 10 value will be either Yes or No. Any help would be great.
Below is a code I am currently using;
Private Sub CommandButton1_Click()
a = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Sheet1.Cells(i, 10).Value = "Yes" Then
Application.ScreenUpdating = False
Sheet1.Rows(i).Copy
Sheet2.Activate
b = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row
Sheet2.Cells(b + 1, 1).Select
ActiveSheet.Paste
Sheet1.Activate
End If
Next
Application.CutCopyMode = Ture
Sheet1.Cells(1, 1).Select
End Sub
Below is a code I am currently using;
Private Sub CommandButton1_Click()
a = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Sheet1.Cells(i, 10).Value = "Yes" Then
Application.ScreenUpdating = False
Sheet1.Rows(i).Copy
Sheet2.Activate
b = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row
Sheet2.Cells(b + 1, 1).Select
ActiveSheet.Paste
Sheet1.Activate
End If
Next
Application.CutCopyMode = Ture
Sheet1.Cells(1, 1).Select
End Sub