PDA

View Full Version : [SOLVED] Data sort automatic??



Ismael
02-10-2005, 03:42 AM
Hi there,

I have a doubt that I explain in the attach file, I think is a simple one....


If any of you guys can take a look I appreciate.

best regards,


Ismael

:beerchug:

Jacob Hilderbrand
02-10-2005, 04:23 AM
Try this.


Option Explicit

Sub Sort()
Range("B9:B20").Sort Key1:=Range("B9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("C9:C20").Sort Key1:=Range("C9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("D9:D20").Sort Key1:=Range("D9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("E9:E20").Sort Key1:=Range("E9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("F9:F20").Sort Key1:=Range("F9"), Order1:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Ismael
02-10-2005, 04:36 AM
Hi DRJ,

Is everything ok with you?

when I execute the macro, a message of an error appear, you can see this error in the attach file.

thanks

Jacob Hilderbrand
02-10-2005, 05:05 AM
I'm doing fine. :)

Try this.



Option Explicit

Sub Sort()
Range("B9:B20").Sort Key1:=Range("B9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("C9:C20").Sort Key1:=Range("C9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("D9:D20").Sort Key1:=Range("D9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("E9:E20").Sort Key1:=Range("E9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("F9:F20").Sort Key1:=Range("F9"), Order1:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

Ismael
02-10-2005, 07:44 AM
Many thanks DRG,

the macro works perfectly, I just delete one more line


DataOption1:=xlSortNormal

I think by mistake you left there, and now everything works nice.



Best regards

Ismael

:beerchug: