Basically I am new to doing any kind of coding and I can input written codes and figure out what I need to change but i am pants at writing anything new.
I have an excel spreadsheet that we keep track of acceptance into a program and rejections. I need to keep track of the rejections on a second sheet so they are all in one area.
I found a VBA code for Excel that successfully copies information I want from one sheet based on value to a second sheet. So when I select "rejected" and run the code, it copies all the data over to the second sheet. It works great with one caveat, every time I run the code it pulls new data and previously copied data.
I would like to add to the VBA code to either not copy data previously copied or find a code that auto deletes the duplicates.
So I did look around to see if I could find some de-dup VBA codes and I tried a few but the original code didn't play well and I got some errors. I had one that looked really good but it doesn't seem to play well with the original copy code.
Below is the current code that is working to copy the rejected.
Private Sub CommandButton1_Click()
a = Worksheets("ARD2019").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Worksheets("ARD2019").Cells(i, 2).Value = "Rejected" Then
Worksheets("ARD2019").Rows(i).Copy
Worksheets("Rejected").Activate
b = Worksheets("Rejected").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Rejected").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("ARD2019").Activate
End If
Next
Application.CutCopyMode = False
My hope here is that I don't have to tell the people using the program to just manually run Excel's deduping function but if it isn't realistic to write a code ontop of the code above, i don't think they will complain since this is still better than what they were doing previously which was manually coping rows over.