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
#66426
Fala pessoal, recorrendo aqui aos amigos para uma ajudinha.

Mandei uma planilha vba anexo, onde eu digito o código do produto e carrega o nome do fornecedor. Até ai tudo bem.

Porém o que eu preciso é que nesse momento aconteça uma verificação na aba RETRABALHO coluna J nas linhas sem data de envio e me informe quantas vezes o nome do fornecedor se repete na coluna G e carregue a quantidade encontrada na TxtCont.

Os códigos estão na aba PRODUTOS.

Desde já agradeço a ajuda.
Você não está autorizado a ver ou baixar esse anexo.
Editado pela última vez por miltonleandro em 20 Ago 2021 às 09:32, em um total de 1 vez.
#66432
experimente:
Altere na rotina Private Sub CbbCodigo_Change ,conforme abaixo
Código: Selecionar todos
..
With Worksheets("PRODUTOS").Range("A:A")
    Set C = .Find(CbbCodigo.Value, LookIn:=xlValues, Lookat:=xlWhole) 'xlWhole, procura a palavra exata
    If Not C Is Nothing Then
        C.Activate
        'para editar, deve-se inverter as funções
        TxtDescricao = C.Offset(0, 1).Value
        CbbFornecedor = C.Offset(0, 4).Value
        TxtCont = ContaRep(TxtFornecedor.Text)
    Else
        MsgBox "Não localizado", vbInformation, "Pesquisa!"
        CbbCodigo = ""
        TxtFornecedor = ""
        TxtCont = ""
        Me.ImgFoto.Picture = LoadPicture() 'Limpar imagem
        CbbCodigo.SetFocus
    End If
End With
...
Adicionalmente inclua a função abaixo no modulo do formulario
Código: Selecionar todos
Private Function ContaRep(ccod As String) As Integer
Dim intLinha As Integer, intFor As Integer
    With Sheets("RETRABALHO")
    For intLinha = 2 To .Range("C2").End(xlDown).Row
        If .Cells(intLinha, 7).Value = ccod And .Cells(intLinha, 10).Value = "" Then intFor = intFor + 1
    Next
    End With
ContaRep = intFor
End Function
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