Hello everyone, I'm trying to sort the "data" sheet by column G then I and it's not working
the code is within another SUB
essentially I'm send data to another sheet with a command button and if there are multiples it will delete them leaving only one and i want to keep the most recent one, column I is the data submission date and column G is the value that needs sorting.
i already have the delete multiple code working but it deleted the latest value added.
With wbLocal.Worksheets("data").Sort
.SortFields.Add Key:=wbLocal.Worksheets("data").Range("G1"), Order:=xlAscending
.SortFields.Add Key:=wbLocal.Worksheets("data").Range("I1"), Order:=xlAscending
.SetRange Range("A1:I50")
.Header = xlYes
.Apply
End With
thanks
the code is within another SUB
essentially I'm send data to another sheet with a command button and if there are multiples it will delete them leaving only one and i want to keep the most recent one, column I is the data submission date and column G is the value that needs sorting.
i already have the delete multiple code working but it deleted the latest value added.
With wbLocal.Worksheets("data").Sort
.SortFields.Add Key:=wbLocal.Worksheets("data").Range("G1"), Order:=xlAscending
.SortFields.Add Key:=wbLocal.Worksheets("data").Range("I1"), Order:=xlAscending
.SetRange Range("A1:I50")
.Header = xlYes
.Apply
End With
thanks