Parsing Data To Sheets With Drop Down Lists

Deploy Data To Sheets According To Values (Ok Or Cancel) On A Column

           When "Run" button is clicked,  if  the value of the data in the E column is "OK" ,row is transfered to "Done" sheet , 
if  the value of the data in the E column is "Cancel" ,row is transfered to "Cancelled" sheet.


       Or without pressing the button in sheet, the "Macro" window is opened by pressing Alt + F8 keys on the keyboard, the macro named "Transfer" is selected and the "Run" button in the macro window is pressed. Thus, the macro is triggered and the transfer process is performed. 

Macro codes that ensure data transfer :
Sub Transfer()
Dim i As Long
For i = 2 To ActiveSheet.Cells(Rows.Count, "E").End(xlUp).Row
If ActiveSheet.Cells(i, "E").Value = "OK" Then
Rows(i).Copy
Sheet2.Range("A" & Sheet2.Cells(Rows.Count, "A").End(xlUp).Row).Offset(1, 0).PasteSpecial xlPasteValues
Rows(i).Delete
i = i - 1
ElseIf ActiveSheet.Cells(i, "E").Value = "Cancel" Then
Rows(i).Copy
Sheet3.Range("A" & Sheet3.Cells(Rows.Count, "A").End(xlUp).Row).Offset(1, 0).PasteSpecial xlPasteValues
Rows(i).Delete
i = i - 1
End If
Next i

For i = 2 To ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Cells(i, "A").Value = i - 1
Next i
End Sub


No comments:

Post a Comment