Hello,
I am hoping you can help.
The below code works on and off. It is driving me mad as it intermittently stops doing the task. I have two sheets (1 & 2) -
When column M (Sheet1) has one of 4 outcomes added (Drop down list), it then moves it from Sheet1 to Sheet2 automatically, problem is it repeatedly stops working after a few successful moves.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
A = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For I = 2 To A
If Worksheets("Sheet1").Cells(I, 13).Value = "Successful" Or Worksheets("Sheet1").Cells(I, 13).Value = "Un-Successful" Or Worksheets("Sheet1").Cells(I, 13).Value = "N/A" Or Worksheets("Sheet1").Cells(I, 13).Value = "Other" Then
Worksheets("Sheet1").Rows(I).Cut
Worksheets("Sheet2").Activate
B = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet2").Cells(B + 1, 1).Select
ActiveSheet.Paste
Worksheets("Sheet1").Activate
End If
Next
For I = 2 To A
If Worksheets("Sheet1").Cells(1, 1).Value = " " Then
Rows(I).Delete
End If
Next
End Sub
Really hope you legends can help me with thism I have been trying for days but, now realise I need to ask the experts for help
Drew
I am hoping you can help.
The below code works on and off. It is driving me mad as it intermittently stops doing the task. I have two sheets (1 & 2) -
When column M (Sheet1) has one of 4 outcomes added (Drop down list), it then moves it from Sheet1 to Sheet2 automatically, problem is it repeatedly stops working after a few successful moves.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
A = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For I = 2 To A
If Worksheets("Sheet1").Cells(I, 13).Value = "Successful" Or Worksheets("Sheet1").Cells(I, 13).Value = "Un-Successful" Or Worksheets("Sheet1").Cells(I, 13).Value = "N/A" Or Worksheets("Sheet1").Cells(I, 13).Value = "Other" Then
Worksheets("Sheet1").Rows(I).Cut
Worksheets("Sheet2").Activate
B = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet2").Cells(B + 1, 1).Select
ActiveSheet.Paste
Worksheets("Sheet1").Activate
End If
Next
For I = 2 To A
If Worksheets("Sheet1").Cells(1, 1).Value = " " Then
Rows(I).Delete
End If
Next
End Sub
Really hope you legends can help me with thism I have been trying for days but, now realise I need to ask the experts for help
Drew