Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tudo que estiver relacionado ao Excel básico, como somar, calcular média, colocar bordas, etc.
  • Avatar do usuário
#58073
Bom Dia!

Preciso de uma ajuda para:
(1) Ordenar cada linha de várias sequências numéricas em ordem crescente;
(2) Classificar todas as sequencias numéricas em ordem crescente.

Exemplo:

Séries originais:
1 3 4 5 6 7 9 10 11 12 13 15 16 17 18
20 18 5 1 3 23 4 10 21 2 19 12 11 24
16 5 17 2 4 15 19 24 7 1 18 21 3 11 20
16 12 1 25 6 13 11 22 2 21 23 10 19 5 20
10 12 16 6 1 13 2 3 18 5 8 21 24 11 20
11 17 24 16 9 1 25 6 14 12 15 7 4 10 19
7 10 3 23 13 15 4 5 16 22 21 6 20 20 17
5 17 22 16 23 19 4 20 1 3 2 25 7 11 10

Após a classificação de cada sequencia numérica:
1 3 4 5 6 7 9 10 11 12 13 15 16 17 18
1 2 3 4 5 7 10 11 12 18 19 20 21 23 24
1 2 3 4 5 7 11 15 16 17 18 19 20 21 24
1 2 5 6 10 11 12 13 16 19 20 21 22 23 25
1 2 3 5 6 8 10 11 12 13 16 18 20 21 24
1 4 6 7 9 10 11 12 14 15 16 17 19 24 25
3 4 5 6 7 10 13 15 16 17 20 20 21 22 23
1 2 3 4 5 7 10 11 16 17 19 20 22 23 25

Após a classificação em ordem crescente das sequências numéricas:
1 2 3 4 5 7 10 11 12 18 19 20 21 23 24
1 2 3 4 5 7 10 11 16 17 19 20 22 23 25
1 2 3 4 5 7 11 15 16 17 18 19 20 21 24
1 2 3 5 6 8 10 11 12 13 16 18 20 21 24
1 2 5 6 10 11 12 13 16 19 20 21 22 23 25
1 3 4 5 6 7 9 10 11 12 13 15 16 17 18
1 4 6 7 9 10 11 12 14 15 16 17 19 24 25
3 4 5 6 7 10 13 15 16 17 20 20 21 22 23

Grata.
#58088
Segue uma solução via macro. Arquivo anexo já com os números e o código instalado.
Código: Selecionar todos
Sub OrdenaLinhas()
 Dim k As Long, LR As Long
  LR = Cells(Rows.Count, 1).End(3).Row
  For k = 1 To LR
   Cells(k, 1).Resize(, 15).Sort Key1:=Cells(k, 1), Order1:=xlAscending, Orientation:=xlLeftToRight
  Next k
  With ActiveSheet.Sort
   With .SortFields
    .Clear
    .Add Key:=Range("A1:A" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("B1:B" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("C1:C" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("D1:D" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("E1:E" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("F1:F" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("G1:G" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("H1:H" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("I1:I" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("J1:J" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("K1:K" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("L1:L" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("M1:M" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("N1:N" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .Add Key:=Range("O1:O" & LR), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
   End With
     .SetRange Range("A1:O" & LR)
     .Header = xlNo
     .MatchCase = False
     .Orientation = xlTopToBottom
     .SortMethod = xlPinYin
     .Apply
  End With
End Sub
Você não está autorizado a ver ou baixar esse anexo.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord