Bonjour à toutes et tous,
Je tente d'exécuter une macro à partir d'une autre mais je dois commettre une erreur car ça ne fonctionne pas, pourtant, lorsque j'exécute la macro appelée elle fait bien son oeuvre.
merci pour votre aide.
La sub transposition est dans un autre module :
Merci pour votre aide
Je tente d'exécuter une macro à partir d'une autre mais je dois commettre une erreur car ça ne fonctionne pas, pourtant, lorsque j'exécute la macro appelée elle fait bien son oeuvre.
merci pour votre aide.
Code:
Sub Macro1()
ActiveWorkbook.Worksheets("Tests").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Tests").Sort.SortFields.Add Key:=Range( _
"A2"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Tests").Sort
.SetRange Range("A2:A4")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Tests").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Tests").Sort.SortFields.Add Key:=Range( _
"A2"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Tests").Sort
.SetRange Range("A2:A4")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("Tests").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Tests").Sort.SortFields.Add Key:=Range( _
"A2"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Tests").Sort
.SetRange Range("A2:A565000")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Call transposition
End Sub
La sub transposition est dans un autre module :
Code:
Option Explicit
Sub transposition()
ActiveWorkbook.Worksheets("Tests").Select
Dim t
t = Range("A2", Cells(Rows.Count, 1).End(xlUp))
Range("B1").Resize(, UBound(t)) = Application.Transpose(t)
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
End Sub
Merci pour votre aide