Boa noite senhores,
alguém pode me ajudar na minha rotina, ela não esta funcionando como deveria, a questão eé que ela deveria filtrar os dados do Listbox1 e trazer esses dados para uma planilha dentro da minha pasta chama PDF (planilha8), os dados em que consulto estão na notas (planilha5), a rotina é executada parcialmente com sucesso pois ela salva os dados em formato pdf, mas o filtro não funciona e não vai para a planilha8 e por tanto não é gerado o relatório com filtro
Saem as duas informações em PDF, mesmo quando eu filtro um mês em questão.
RECEBIMENTO EMISSÃO DUPLICATA A VALOR A DUPLICATA B VALOR B FORNECEDOR Nº DA NF TOTAL ICMS
05/08/2019 05/08/2019 05/08/2019 R$ 8.525,25 05/08/2019 R$ 7.254,25 ADIDAS DO BRASIL 363535 R$ 14.500,25 335,00%
05/09/2019 05/09/2019 05/09/2019 R$ 8.525,25 05/09/2019 R$ 7.254,25 ADIDAS DO BRASIL 363535 R$ 14.500,25 335,00%
Poderiam me auxiliar?
segue rotina.
Private Sub CommandButton2_Click()
Planilha5.Activate
Planilha5.Select
Planilha5.Unprotect Planilha1.Range("Z1").Text
If ListBox1.ListCount = 0 Then
MsgBox "Não há dados a ser exportado!", vbCritical, "RELATÓRIO"
Exit Sub
End If
Planilha5.Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range("A2").Select
Planilha5.Cells(1, 1) = "RECEBIMENTO"
Planilha5.Cells(1, 2) = "EMISSÃO"
Planilha5.Cells(1, 3) = "DUPLICATA A"
Planilha5.Cells(1, 4) = "VALOR A"
Planilha5.Cells(1, 5) = "DUPLICATA B"
Planilha5.Cells(1, 6) = "VALOR B"
Planilha5.Cells(1, 7) = "FORNECEDOR"
Planilha5.Cells(1, 😎 = "Nº DA NF"
Planilha5.Cells(1, 9) = "TOTAL"
Planilha5.Cells(1, 10) = "ICMS"
Dim numero As Double
Dim numero1 As Double
Dim numero2 As Double
Dim data As Date
Dim data1 As Date
Dim data2 As Date
Dim data3 As Date
Dim valor As Currency
Dim valor1 As Currency
Dim valor2 As Currency
linha = 1
For item = 1 To ListBox1.ListCount - 1
On Error Resume Next
data = ListBox1.List(item, 1)
On Error Resume Next
data1 = ListBox1.List(item, 2)
On Error Resume Next
data2 = ListBox1.List(item, 3)
On Error Resume Next
valor = ListBox1.List(item, 4)
On Error Resume Next
data3 = ListBox1.List(item, 5)
On Error Resume Next
valor1 = ListBox1.List(item, 6)
On Error Resume Next
numero2 = ListBox1.List(item, 7)
On Error Resume Next
numero = ListBox1.List(item, 😎
On Error Resume Next
valor2 = ListBox1.List(item, 9)
On Error Resume Next
numero1 = ListBox1.List(item, 10)
Planilha5.Cells(lihha, 1) = data
Planilha5.Cells(lihha, 2) = data1
Planilha5.Cells(lihha, 3) = data2
Planilha5.Cells(lihha, 4) = valor
Planilha5.Cells(lihha, 5) = data3
Planilha5.Cells(lihha, 6) = valor1
Planilha5.Cells(lihha, 7) = numero
Planilha5.Cells(lihha, 😎 = numero
Planilha5.Cells(lihha, 9) = valor2
Planilha5.Cells(lihha, 10) = numero1
linha = linha + 1
Next
Resp = MsgBox("Dados Exportados! Gerar PDF?", vbYesNo, "Exportar PDF")
If Resp = vbYes Then
Módulo1.pdf_relatorios
Planilha5.Protect Planilha1.Range("Z1").Text
End If
End Sub
Utilizo-me desta SUB:
Sub pdf_relatorios()
On Error GoTo Erro
Planilha5.Activate
Planilha5.Select
Planilha5.Range("A1").Select
caminho = ThisWorkbook.Path & "\PDF NOTAS.pdf"
Selection.End(xlDown).Select
Intersect(Selection.EntireRow, Range("A:J")).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
caminho, Quality:=xlQualityStandard
IncludeDocProperties = True
ingnoreprintareas = False
openafterpublish = True
Exit Sub
Erro:
MsgBox "Erro!", vbCritical, "PDF RELATORIOS"
End Sub
Caso possam me ajudar, expliquem o motivo do codigo não esta dando certo também, preciso aprender.
obrigado pessoal.
Pergunta
Brucinho
Boa noite senhores,
alguém pode me ajudar na minha rotina, ela não esta funcionando como deveria, a questão eé que ela deveria filtrar os dados do Listbox1 e trazer esses dados para uma planilha dentro da minha pasta chama PDF (planilha8), os dados em que consulto estão na notas (planilha5), a rotina é executada parcialmente com sucesso pois ela salva os dados em formato pdf, mas o filtro não funciona e não vai para a planilha8 e por tanto não é gerado o relatório com filtro
Saem as duas informações em PDF, mesmo quando eu filtro um mês em questão.
RECEBIMENTO EMISSÃO DUPLICATA A VALOR A DUPLICATA B VALOR B FORNECEDOR Nº DA NF TOTAL ICMS
05/08/2019 05/08/2019 05/08/2019 R$ 8.525,25 05/08/2019 R$ 7.254,25 ADIDAS DO BRASIL 363535 R$ 14.500,25 335,00%
05/09/2019 05/09/2019 05/09/2019 R$ 8.525,25 05/09/2019 R$ 7.254,25 ADIDAS DO BRASIL 363535 R$ 14.500,25 335,00%
Poderiam me auxiliar?
segue rotina.
Private Sub CommandButton2_Click() Planilha5.Activate Planilha5.Select Planilha5.Unprotect Planilha1.Range("Z1").Text If ListBox1.ListCount = 0 Then MsgBox "Não há dados a ser exportado!", vbCritical, "RELATÓRIO" Exit Sub End If Planilha5.Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Range("A2").Select Planilha5.Cells(1, 1) = "RECEBIMENTO" Planilha5.Cells(1, 2) = "EMISSÃO" Planilha5.Cells(1, 3) = "DUPLICATA A" Planilha5.Cells(1, 4) = "VALOR A" Planilha5.Cells(1, 5) = "DUPLICATA B" Planilha5.Cells(1, 6) = "VALOR B" Planilha5.Cells(1, 7) = "FORNECEDOR" Planilha5.Cells(1, 😎 = "Nº DA NF" Planilha5.Cells(1, 9) = "TOTAL" Planilha5.Cells(1, 10) = "ICMS" Dim numero As Double Dim numero1 As Double Dim numero2 As Double Dim data As Date Dim data1 As Date Dim data2 As Date Dim data3 As Date Dim valor As Currency Dim valor1 As Currency Dim valor2 As Currency linha = 1 For item = 1 To ListBox1.ListCount - 1 On Error Resume Next data = ListBox1.List(item, 1) On Error Resume Next data1 = ListBox1.List(item, 2) On Error Resume Next data2 = ListBox1.List(item, 3) On Error Resume Next valor = ListBox1.List(item, 4) On Error Resume Next data3 = ListBox1.List(item, 5) On Error Resume Next valor1 = ListBox1.List(item, 6) On Error Resume Next numero2 = ListBox1.List(item, 7) On Error Resume Next numero = ListBox1.List(item, 😎 On Error Resume Next valor2 = ListBox1.List(item, 9) On Error Resume Next numero1 = ListBox1.List(item, 10) Planilha5.Cells(lihha, 1) = data Planilha5.Cells(lihha, 2) = data1 Planilha5.Cells(lihha, 3) = data2 Planilha5.Cells(lihha, 4) = valor Planilha5.Cells(lihha, 5) = data3 Planilha5.Cells(lihha, 6) = valor1 Planilha5.Cells(lihha, 7) = numero Planilha5.Cells(lihha, 😎 = numero Planilha5.Cells(lihha, 9) = valor2 Planilha5.Cells(lihha, 10) = numero1 linha = linha + 1 Next Resp = MsgBox("Dados Exportados! Gerar PDF?", vbYesNo, "Exportar PDF") If Resp = vbYes Then Módulo1.pdf_relatorios Planilha5.Protect Planilha1.Range("Z1").Text End If End SubUtilizo-me desta SUB:
Sub pdf_relatorios() On Error GoTo Erro Planilha5.Activate Planilha5.Select Planilha5.Range("A1").Select caminho = ThisWorkbook.Path & "\PDF NOTAS.pdf" Selection.End(xlDown).Select Intersect(Selection.EntireRow, Range("A:J")).Select Range(Selection, Selection.End(xlUp)).Select Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ caminho, Quality:=xlQualityStandard IncludeDocProperties = True ingnoreprintareas = False openafterpublish = True Exit Sub Erro: MsgBox "Erro!", vbCritical, "PDF RELATORIOS" End SubCaso possam me ajudar, expliquem o motivo do codigo não esta dando certo também, preciso aprender.
obrigado pessoal.
Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.