Dear Seb, I have fixed your macro problem.
I made changes in your module2 macro call (named as : Sorting)
I have checked it it's now correctly working.
Please check at your end, and let me know.
By the way I liked your work in the file which you have sent, you are wonderful in Excel.
Sub sorting(range1 As String)
there1 = True
Application.ScreenUpdating = False
Dim SrtRange As String
SrtRange = "A5:I" & Range("a4").End(xlDown).Row ' make sure that A4 & A5 must not be empty
Range("a5").Select
For a = 1 To 10
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
ActiveCell.Offset(0, 1).Select
seb = ActiveCell.Column
Next
Range(ref).Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
If ascending = True Then
Range(SrtRange).Sort Key1:=Range(ref), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Else
Range(SrtRange).Sort Key1:=Range(ref), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If
oldref = ref
oldrange = range1
there1 = False
End Sub
|