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

Dúvidas sobre cálculos, funções simples e aninhadas, fórmulas matriciais, etc.
  • Avatar do usuário
#5435
Há alguns dias o Parkeless mandou legal e resolveu mais um problema, agora, em situação parecida com essa anterior, pergunto quem pode ajudar a calcular a distância (EM APENAS UMA COLUNA) SEMPRE do último zero (0) até o último preenchimento desta ...

EXEMPLO :

2
2
3
0
1
0
4
1
2
2
1
3
4
4
2
1
2
2
1

Neste caso, 13 linhas até a célula que não possui mais preenchimento.
Pode sem funções ou módulos, tanto faz ... Valeu.
#5452
Olá novamente Mucango!

Fiz o teste usando a mesma função que fiz da outra vez, e está dando certo.
Código: Selecionar todos
Dim cell As Range
Dim Coluna_ocorrencia As Long
Dim Ocorrencia As Range
Dim ultimalinha As Long

Set Ocorrencia = Intervalo.Cells(1, 1)

'Determinar última ocorrencia
For Each cell In Intervalo
    If cell = Criterio Then
        'Verificar ocorrencia; se estiver mais abaixo, trocar
        If cell.Row > Ocorrencia.Row Then
            Set Ocorrencia = cell
            Coluna_ocorrencia = cell.Column
        End If
    End If
Next cell

'Determinar última linha do intervalo
For Each cell In Intervalo
    If cell.Row > ultimalinha Then: ultimalinha = cell.Row
Next cell


Distancia_ocorrencias_v3 = ultimalinha - Ocorrencia.Row

End Function
#5459
Ficou mesmo kk, desculpe.

Só acessar o tópico que você tinha aberto na época (vá na pesquisa avançada do fórum, e procure por autor - "Mucango"), e copiar o código completo lá. Fiz o teste aqui, e retornou o valor 13, então está certinho.
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