Автор: VolunKOV
Дата сообщения: 22.01.2010 15:39
Подскажите, пожалуйста, как можно упростить и распространить действие на любое количество ячеек такой макрос записанный вручную:
[more=Макрос...]Sub Макрос1()
'
' Макрос1 Макрос
' Макрос записан 22.01.2010 (Administrator)
'
'
Range("A2:C2").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A3:C3").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A4:C4").Select
Selection.Sort Key1:=Range("A4"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A5:C5").Select
Selection.Sort Key1:=Range("A5"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A6:C6").Select
Selection.Sort Key1:=Range("A6"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A7:C7").Select
Selection.Sort Key1:=Range("A7"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A8:C8").Select
Selection.Sort Key1:=Range("A8"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A9:C9").Select
Selection.Sort Key1:=Range("A9"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A10:C10").Select
Selection.Sort Key1:=Range("A10"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A11:C11").Select
Selection.Sort Key1:=Range("A11"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A12:C12").Select
Selection.Sort Key1:=Range("A12"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A13:C13").Select
Selection.Sort Key1:=Range("A13"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A14:C14").Select
Selection.Sort Key1:=Range("A14"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A15:C15").Select
Selection.Sort Key1:=Range("A15"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A16:C16").Select
Selection.Sort Key1:=Range("A16"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A17:C17").Select
Selection.Sort Key1:=Range("A17"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A18:C18").Select
Selection.Sort Key1:=Range("A18"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A19:C19").Select
Selection.Sort Key1:=Range("A19"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A30:C30").Select
Selection.Sort Key1:=Range("A30"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A31:C31").Select
Selection.Sort Key1:=Range("A31"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A32:C32").Select
Selection.Sort Key1:=Range("A32"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A33:C33").Select
Selection.Sort Key1:=Range("A33"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A34:C34").Select
Selection.Sort Key1:=Range("A34"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A35:C35").Select
Selection.Sort Key1:=Range("A35"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A36:C36").Select
Selection.Sort Key1:=Range("A36"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A37:C37").Select
Selection.Sort Key1:=Range("A37"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A38:C38").Select
Selection.Sort Key1:=Range("A38"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Range("A39:C39").Select
Selection.Sort Key1:=Range("A39"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
End Sub
[/more]