I have a spreadsheet of 16 columns. I have written a macro that does the following: Do a text search on the columns I, J, K. Filter the result using criteria colG => Montant2 and colG <= Montant1. Montant1 and 2 are input by the user. Then write the results in a new sheet as colB to colB, colD to colC, colF to colD, colG to colE. Sort the result based on colD , colC in that order, remove duplicates that have colD and colC equal. Format the number field in colE as "#.###0.00".
I have done the text search and filtering. When it came to sort, remove and reformat it does not give any errors but does nothing. Here is the relevant code. To reformat the number field in new sheet colE:
To remove duplicates I tried:
Also I tried:
and this:
Any help is highly appreciated.
I have done the text search and filtering. When it came to sort, remove and reformat it does not give any errors but does nothing. Here is the relevant code. To reformat the number field in new sheet colE:
Code:
Worksheets(tName).Activate
Worksheets(tName).Columns("E").ColumnWidth = 15
Worksheets(tName).Columns("E").NumberFormat = "#,###0.00"
To remove duplicates I tried:
Code:
ActiveSheet.[A1].CurrentRegion.RemoveDuplicates Columns:=5, Header:=xlYes
Also I tried:
Code:
JMAX = Sheets(tName).Cells(Rows.Count, "B").End(xlUp).Row StartRow = 2
LastRow = JMAX
Let CopyRange = "A" & StartRow & ":" & "E" & LastRow
ActiveSheet.Sort.SortFields.Add Range(CopyRange), xlSortOnValues, xlAscending
and this:
Code:
ActiveSheet.[A1].CurrentRegion.RemoveDuplicates Columns:=5, Header:=xlYes
Any help is highly appreciated.