Hi,
1. If status is "Ready for Repair" move to Sheet "Repair" and so on...
The following macro is working but I would like to add multiple status checks.... how can I do that?
2. One macro should check for all sheets if the status is "Resent/Picked-Up" and move it to the sheet "Archive"
How can I alter the above macro so it checks for all sheets except the ARchive one?
I want a macro to move a row based on the cell value into a specific sheets.
I have two questions and would really appreciate your help. Especially the second is important.1. If status is "Ready for Repair" move to Sheet "Repair" and so on...
The following macro is working but I would like to add multiple status checks.... how can I do that?
2. One macro should check for all sheets if the status is "Resent/Picked-Up" and move it to the sheet "Archive"
How can I alter the above macro so it checks for all sheets except the ARchive one?
Sub Repair()
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("Repair Form").UsedRange.Rows.Count
J = Worksheets("Repair").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Repair").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Repair Form").Range("A2:A" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) = "Ready for Repair" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Repair").Range("A" & J + 1)
xRg(K).EntireRow.Delete
If CStr(xRg(K).Value) = "Ready for Repair" Then
K = K - 1
End If
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("Repair Form").UsedRange.Rows.Count
J = Worksheets("Repair").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Repair").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Repair Form").Range("A2:A" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) = "Ready for Repair" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Repair").Range("A" & J + 1)
xRg(K).EntireRow.Delete
If CStr(xRg(K).Value) = "Ready for Repair" Then
K = K - 1
End If
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub