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
#13880
Boa Noite
Estou tentando concluir uma planilha mais estou tendo problema para extrair o relatório com formulário.
Estou utilizando 3 critérios mais somente o primeiro não está extraindo, os 2 e 3 extra extraindo normalmente.
Vou encaminhar a planilha para alguém me dar apoio.
#13889
Bom dia!!

Porque simplesmente não filtra os dados e depois copia para guia desejada?
Código: Selecionar todos
Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False
    With Sheets("PQ").UsedRange.Offset(1)
        .AutoFilter
        If Cd_Status.ListIndex > -1 Then .AutoFilter 2, Cd_Status.Value
        If CdRp.ListIndex > -1 Then .AutoFilter 3, CdRp.Value
        If CdSegmento.ListIndex > -1 Then .AutoFilter 5, CdSegmento.Value
        'Depois copia os dados filtrados para outra guia?
    End With
    Application.ScreenUpdating = True
End Sub
Att
#13951
Boa tarde!
Tente
Código: Selecionar todos
Private Sub CB_Gerar_Click()
Dim Lr As Long
    Application.ScreenUpdating = False
    Lr = Sheets("PQ").Range("B" & Rows.Count).End(xlUp).Row
    With Sheets("PQ").UsedRange.Offset(1)
        .AutoFilter
        If Cd_Status.ListIndex > -1 Then .AutoFilter 2, Cd_Status.Value
        If CdRp.ListIndex > -1 Then .AutoFilter 3, CdRp.Value
        If CdSegmento.ListIndex > -1 Then .AutoFilter 5, CdSegmento.Value
        'Depois copia os dados filtrados para outra guia?
        'Range("A2", Range("A" & Rows.Count).End(xlUp))
        .Range("H5:H" & Lr).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("ATIVIDADE").Range("C" & Rows.Count).End(xlUp).Offset(1)
        .Range("I5:I" & Lr).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("ATIVIDADE").Range("D" & Rows.Count).End(xlUp).Offset(1)
        .Range("M5:M" & Lr).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("ATIVIDADE").Range("E" & Rows.Count).End(xlUp).Offset(1)
        .Range("P5:P" & Lr).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("ATIVIDADE").Range("F" & Rows.Count).End(xlUp).Offset(1)
        .Range("V5:V" & Lr).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("ATIVIDADE").Range("G" & Rows.Count).End(xlUp).Offset(1)
        .Range("S5:S" & Lr).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("ATIVIDADE").Range("H" & Rows.Count).End(xlUp).Offset(1)
        .Range("D5:D" & Lr).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("ATIVIDADE").Range("K" & Rows.Count).End(xlUp).Offset(1)
    End With

End Sub
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