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 kleinowski
Posts
#39572
Boa Noite.
Tenho o seguinte código:
Código: Selecionar todos
 Dim c As Range, K As Long

  With Sheets("Ficha")
  
.Range(.[L16], .[L16].End(4)).Interior.ColorIndex = xlNone
For Each c In .Range(.[L16], .[L16].End(4))


     K = Sheets("Hastes").Range("A3", Sheets("Hastes").[A3].End(4)).Find(c.Value, lookat:=xlWhole).Row
    If c.Offset(, 0).Value <> Sheets("Hastes").Cells(K, 1) Or c.Offset(, 2).Value <> Sheets("Hastes").Cells(K, 2) Then

 c.Resize(, 3).Interior.ColorIndex = 3
    End If
   
   Next c
  End With
 
Esse código compara os dados de duas Planilhas.

A questão é que, com esse código ele só procura os valores da coluna "B" na aba "Hastes". Porem alguns itens tem mais do que 1 tamanho de haste.
Se for executado a macro, vai ser pintado 3 itens da aba ficha, porem esses itens estão certo, só que o valor da haste está em outra coluna. E este código busca os valores apenas na coluna B. Precisava que ele buscasse os dados nas outras colunas tambem.

Tentei colocar um .End(4) ou até mesmo um offset mas não obtive sucesso. Alguem poderia me ajudar com isso?
Você não está autorizado a ver ou baixar esse anexo.
Por babdallas
#39599
Veja se entendi...
Código: Selecionar todos
Public Sub Compara_Hastes()
Dim c As Range, K As Long

    With wsFicha
        .Range(.[L16], .[L16].End(4)).Interior.ColorIndex = xlNone
        For Each c In .Range(.[L16], .[L16].End(4))

            K = wsHastes.Range("A3", wsHastes.[A3].End(4)).Find(c.Value, lookat:=xlWhole).Row
            
            If Application.WorksheetFunction.CountIf( _
                wsHastes.Range(wsHastes.Cells(K, 1), wsHastes.Cells(K, 1).End(xlToRight)), c.Offset(, 2).Value2) > 0 Then
                
                c.Resize(, 3).Interior.ColorIndex = 3
            End If
            
        Next c
  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