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
Por Sandra1601
#12583
Boa Noite Pessoal

Estou desenvolvendo um pequeno projeto meu primeiro .... estou Buscando informação por data
sendo a data a partir da celula a1 a Busca da data da celula a1 ate onde tiver cadastro ta ok porem quero que aBra as demais colunas conforme aBaixo
DATA Código Descrição Produzido Devolvido Vendido


onde esta meu erro
Código: Selecionar todos
Private Sub TextBox1_Change()
 
    Dim guia As Worksheet
    Dim linha As Integer
    Dim coluna As Integer
    Dim linhalistbox As Integer
    Dim valor_celula As String
    Dim valor_pesquisado As String
    Dim conta_registros As Integer
    Set guia = ThisWorkbook.Worksheets("Plan1")
    
    valor_pesquisado = TextBox1.Text
    
    linha = 2
    coluna = 1
    
     
    linhalistbox = 0
    conta_registros = 0
    
    ListBox1.Clear
   
    With guia
        While .Cells(linha, coluna).Value <> Empty
          valor_celula = .Cells(linha, coluna).Value
            
         If UCase(Left(valor_celula, Len(valor_pesquisado))) = UCase(valor_pesquisado) Then
                
             With ListBox1
             .AddItem
              .List(linhalistbox, 0) = Sheets("Plan1").Cells(linha, 1)
             
             
            
              linhalistbox = linhalistbox + 1
             conta_registros = conta_registros + 1
             End With
                
            End If
            linha = linha + 1
        Wend
    End With
    
 Label1 = conta_registros & "  Despesas Cadastradas"

End Sub

Private Sub UserForm_Initialize()
 Call atualiza
 End Sub
  Sub atualiza()
 Dim linha As Integer
 Dim linhalistbox As Integer
 Dim conta_registros As Integer

ListBox1.Clear
linha = 2
 
linhalistbox = 0

Sheets("Plan1").Select

Do Until Sheets("Plan1").Cells(linha, 1) = ""

    With ListBox1
    
    .AddItem
     .List(linhalistbox, 0) = Sheets("Plan1").Cells(linha, 1)
                
     
      
    End With
    linhalistbox = linhalistbox + 1

linha = linha + 1
conta_registros = conta_registros + 1
Loop
 
Label1 = conta_registros & "  Datas Cadastradas"

End Sub
Avatar do usuário
Por alexandrevba
Avatar
#12725
Boa tarde!!

Eu não entendi o que vc realmente pretende.

Poderia postar seu arquivo modelo(nele deixa claro o antes e depois do resultado que pretende)?

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