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.
Por vilc
Posts
#72002
Boa noite, estou com esse código, porem não esta filtrando, quando clico no botão para filtrar a listbox fica vazio,
meu listbox já abre com os dados carregados!

segue o código, desde já agradeço a todos.

Private Sub BtnPesquisarEntrada_Click()


'condição se nao for selecionado as datas para pesquisa não vai executar o codigo


If Me.TxtDataIncio = "" Or Me.TxtDataFinal = "" Then

MsgBox ("Favor preencher a data incial e final para a pesquisa")

Exit Sub

End If



Dim Linha, LinhaListbox As Long
Dim ws As Worksheet



Set ws = ThisWorkbook.Worksheets("Entrada")
Linha = 2
LinhaListbox = 0

ListBoxEntrada.Clear

With ws




While ws.Cells(Linha, 1).Value <> Empty

If ws.Cells(Linha, 2) >= CDate(TxtDataIncio.Value) And Cells(Linha, 2) <= CDate(TxtDataFinal.Value) Then

With FormEntrada.ListBoxEntrada
.AddItem
.List(LinhaListbox, 0) = ws.Cells(Linha, 1) 'Equipamento A
.List(LinhaListbox, 1) = ws.Cells(Linha, 2) 'Quantidade' B
.List(LinhaListbox, 2) = ws.Cells(Linha, 3) 'NF C
.List(LinhaListbox, 3) = ws.Cells(Linha, 4) 'Data D
.List(LinhaListbox, 4) = ws.Cells(Linha, 5) 'Obs E



LinhaListbox = LinhaListbox + 1
End With


End If

Linha = Linha + 1
Wend





End With






LblRegistros.Caption = LinhaListbox & " Registro(s) Encontrado(s)."


'End With

End Sub
Por vilc
Posts
#72019
Boa noite, consegui resolver aqui, onde está 2 nessa linha, tinha que trocar pela coluna onde está a data.
If ws.Cells(Linha, 2) >= CDate(TxtDataIncio.Value) And Cells(Linha, 2) <= CDate(TxtDataFinal.Value) Then
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