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

Tudo que estiver relacionado ao Excel básico, como somar, calcular média, colocar bordas, etc.
Por JuniorDist
#54357
Olá pessoal, estou com um problema (que talvez seja fácil de resolver mas estou quebrando a cabeça kkk), tenho duas listas de e-mails, A e B, a lista A contem e-mails que precisam ser excluídos da lista B, porém são mais de 200 linhas de contatos e é muito chato ir buscado manualmente na lista B e ir excluindo, teria alguma maneira mais fácil de resolver o problema?
Por babdallas
#54358
Veja se ajuda.
Código: Selecionar todos
Public Sub Apagar_Email_ListaA_na_ListaB()
    Dim vrtDadosA           As Variant
    Dim vrtDadosB           As Variant
    Dim strDadosC()         As String
    Dim lngUltLinA          As Long
    Dim lngUltLinB          As Long
    Dim lngContC            As Long
    Dim lngCont             As Long
    
    
    With Planilha1
        lngUltLinA = .Cells(.Rows.Count, 1).End(xlUp).Row
        lngUltLinB = .Cells(.Rows.Count, 2).End(xlUp).Row
        
        vrtDadosA = .Range("A2:A" & lngUltLinA).Value2
        vrtDadosB = .Range("B2:B" & lngUltLinB).Value2
        
        ReDim strDadosC(1 To lngUltLinA) As String
        
        For lngCont = LBound(vrtDadosB) To UBound(vrtDadosB)
            If Application.WorksheetFunction.CountIf(.Range("A2:A" & lngUltLinA), vrtDadosB(lngCont, 1)) = 0 Then
                lngContC = lngContC + 1
                strDadosC(lngContC) = vrtDadosB(lngCont, 1)
            End If
        Next lngCont
        
        ReDim Preserve strDadosC(1 To lngContC) As String
        
        .Range(.Cells(2, 2), .Cells(lngUltLinB, 2)).ClearContents
        .Range("B2:B" & lngContC + 1).Value2 = Application.Transpose(strDadosC)
    End With
    
End Sub
Você não está autorizado a ver ou baixar esse anexo.
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