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

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
  • Avatar do usuário
#20811
Bom dia!

Pergunta posta em outro fórum e não obtive a resposta.

Solicito a sua ajuda, para colocar o cadastro de clientes na ordem de data através do VBA.

Conforme instruções no anexo.

Tentei e não consegui.

Grato - GENECI.
Você não está autorizado a ver ou baixar esse anexo.
#20815
Bom dia!!

Não testado!!
Código: Selecionar todos
Sub AleVBA_4202V2()
Dim rCrit As Range, rRng As Range

Set rCrit = Range("AleVBA")
Set rRng = Worksheets("CADASTRO").Range("A1:F2500")

With rRng
    .AutoFilter field:=2, Criteria1:=rCrit.Value
    rRng.SpecialCells(xlCellTypeVisible).EntireRow.Copy Destination:=Worksheets("CONSULTAESTADO").Range("A3")
    .AutoFilter
End With
'GM
    Range("A3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    ActiveWorkbook.Worksheets("CONSULTAESTADO").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("CONSULTAESTADO").Sort.SortFields.Add Key:=Range("A4:A7"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("CONSULTAESTADO").Sort
        .SetRange Range("A3:X7000")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub
Obs: Editado por AlexandreVBA

Att
#20829
Boa noite!!

Eu não entendi :(

Tem como você postar o resultado de forma manual para que possamos entender?

Att
#20839
Bom dia! Alexandrevba

Obtive o resultado para o problema.

A título de estudo fico grato, quanto o procedimento que criastes através de macro.
Por favor, retornar o arquivo com a solução para um comparativo.

Grato - GENECI.
Você não está autorizado a ver ou baixar esse anexo.
#20840
Bom dia!!

Para o erro alter alinha
Código: Selecionar todos
Set rCrit = Range("AleVBA")
Para
Código: Selecionar todos
Set rCrit = Worksheets("CONSULTAESTADO").Range("C1") 
Acontece que no meu arquivo tinha uma célula nomeada, e no seu arquivo não.

Att
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