Hi all,
I know this has come up a million times before, and I have search for the answer and seemed to find some, but when I try to use the code it doesn't seem to work for me, as it deletes the original row or wont paste into the correct area on my second worksheet.
What I'd like to do is be able to fill in the below example, and when i choose FAIL it will copy the entire row into the next available row on the Failures worksheet
So that the above "test" would result in a failure list as per the below example...
This is the code that I'd found online to try and edit to fit my needs but I'm struggling to get it to work with my VERY basic knowledge of macros....
Sub MoveBasedonValue()
Dim xRg As Range
Dim xCell As Range
Dim A As Long
Dim B As Long
Dim C As Long
A = Worksheets("master").UsedRange.Rows.Count
B = Worksheets("completed").UsedRange.Rows.Count
If B = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("completed").UsedRange) = 0 Then B = 0
End If
Set xRg = Worksheets("master").Range("D1:D" & A)
On Error Resume Next
Application.ScreenUpdating = False
For C = 1 To xRg.Count
If CStr(xRg(C).Value) = "Done" Then
xRg(C).EntireRow.Copy Destination:=Worksheets("completed").Range("A" & B + 1)
xRg(C).EntireRow.Delete
If CStr(xRg(C).Value) = "Done" Then
C = C - 1
End If
B = B + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Any help with getting this working would be fantastic and greatly appreciated!!
Thanks,
Shwan
I know this has come up a million times before, and I have search for the answer and seemed to find some, but when I try to use the code it doesn't seem to work for me, as it deletes the original row or wont paste into the correct area on my second worksheet.
What I'd like to do is be able to fill in the below example, and when i choose FAIL it will copy the entire row into the next available row on the Failures worksheet
So that the above "test" would result in a failure list as per the below example...
This is the code that I'd found online to try and edit to fit my needs but I'm struggling to get it to work with my VERY basic knowledge of macros....
Sub MoveBasedonValue()
Dim xRg As Range
Dim xCell As Range
Dim A As Long
Dim B As Long
Dim C As Long
A = Worksheets("master").UsedRange.Rows.Count
B = Worksheets("completed").UsedRange.Rows.Count
If B = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("completed").UsedRange) = 0 Then B = 0
End If
Set xRg = Worksheets("master").Range("D1:D" & A)
On Error Resume Next
Application.ScreenUpdating = False
For C = 1 To xRg.Count
If CStr(xRg(C).Value) = "Done" Then
xRg(C).EntireRow.Copy Destination:=Worksheets("completed").Range("A" & B + 1)
xRg(C).EntireRow.Delete
If CStr(xRg(C).Value) = "Done" Then
C = C - 1
End If
B = B + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Any help with getting this working would be fantastic and greatly appreciated!!
Thanks,
Shwan