Hello,
I am a French developer with access and excel.
my job today is to format an excel file through an access application.
The mistake today is how I can sort my data when the number of rows is different each time , my file is a result and I have to give it in excel format.
here is my mistake
aaa = ActiveSheet.UsedRange.Rows.Count + ActiveSheet.UsedRange.Row - 1
bb = "B2,H" & aaa
aa = "A2,H" & aaa
ActiveWorkbook.Worksheets("transfert_compta").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("transfert_compta").Sort.SortFields.Add Key:=Range(bb), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("transfert_compta").Sort
.SetRange Range(aa)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Thank you for the answer
Daniel
Bookmarks