Currently, I'm developing a worksheet to track and manage drivers for my business. A button I have activates some VBA code to eliminate duplicates. Once, it works incredibly well. But, the button stops functioning if I remove some of the data and then add new data to the set. Every time I click the button, I want it to perform the same action. It's just not practical for me to open a new worksheet every time I want to add more drivers to be tracked. My skills in this area are quite minimal, so any assistance is greatly welcomed. The more extensive your explanation or teaching, the better (and patience). Thank you in advance.
Below I have added the code I have for the Remove Duplicates button and a screenshot of what my sheet looks like.
Private Sub CommandButton2_Click()
Dim rg As Range
With Worksheets("Driver Info Tool")
lgLastRow = .Range("A" & .Rows.Count).End(xlUp).Row
Set rgData = .Range("A1:D" & lgLastRow)
.Sort Key1:=.Columns(4), Order1:=xlDescending, Header:=xlYes
.RemoveDuplicates Columns:=1, Header:=xlYes