Hi everyone I have the macro below that works well. I just need to expand on it and need some guidance.
It currently moves data found in sheet 1 to sheet 2 if the values in column F = "Y". First, I would like the formulas on columns F:I to be copied to the last cell with data. Then, I need more conditions, for example if any cell in column "G" = No Issues Found, move to sheet 3, if cells in column "H" = Review then move to sheet 4 and if the cell in column "I" equals "Test Fail" then move to sheet5.
Biggest issue I'm thinking is that some rows MIGHT need to be in multiple tabs but everything I found in Google deletes the row once it meets the first criteria.
Sub MoveData()
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
Dim L As Long
I = Worksheets("Sheet1").UsedRange.Rows.count
J = Worksheets("Sheet2").UsedRange.Rows.count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Sheet2").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Sheet1").Range("F1:F" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.count
If CStr(xRg(K).Value) = "Y" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Sheet2").Range("A" & J + 2)
xRg(K).EntireRow.Delete
If CStr(xRg(K).Value) = "Y" Then
K = K - 1
End If
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Bookmarks