Procedure too large

AnonFixe

New Member
Joined
Jul 1, 2021
Messages
7
Office Version
  1. 365
Platform
  1. Windows
VBA Code:
Sub testes()

linha = 8 '<----- Linha da folha do excel
linha2 = 9
linha3 = 10
Linha4 = 11
Linha5 = 12

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Poliméricos" And Cells(linha, 3) = PBF And Cells(linha, 4) = "1" Then
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Falha de Cura"
    Cells(linha3, 5) = "Delaminação"
    Cells(Linha4, 5) = "Microporosidades"
    Cells(Linha5, 5) = "--------------------"
End If
If Cells(linha, 2) = "Cerâmicos" Then
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades"
    Cells(Linha4, 5) = "Densidade"
    Cells(Linha5, 5) = "---------------------"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 12) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 13) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 14) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 13) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 14) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 7) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 8) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 9) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 12) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 10) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 11) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 12) = "DEF 01> PBF > Metal > 1"
End If
'Complexidade 2 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "2" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "2" Then
    Cells(linha, 6) = "DEF 01> PBF > Metal > 2"
    Cells(linha, 8) = "DEF 01> PBF > Metal > 2"
    Cells(linha, 9) = "DEF 01> PBF > Metal > 2"
    Cells(linha, 10) = "DEF 01> PBF > Metal > 2"
    Cells(linha, 11) = "DEF 01> PBF > Metal > 2"
    Cells(linha, 12) = "DEF 01> PBF > Metal > 2"
    Cells(linha, 13) = "DEF 01> PBF > Metal > 2"
    Cells(linha, 14) = "DEF 01> PBF > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "2" Then
    Cells(linha2, 7) = "DEF 01> PBF > Metal > 2"
    Cells(linha2, 8) = "DEF 01> PBF > Metal > 2"
    Cells(linha2, 9) = "DEF 01> PBF > Metal > 2"
    Cells(linha2, 10) = "DEF 01> PBF > Metal > 2"
    Cells(linha2, 11) = "DEF 01> PBF > Metal > 2"
    Cells(linha2, 13) = "DEF 01> PBF > Metal > 2"
    Cells(linha2, 14) = "DEF 01> PBF > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "2" Then
    Cells(linha3, 7) = "DEF 01> PBF > Metal > 2"
    Cells(linha3, 8) = "DEF 01> PBF > Metal > 2"
    Cells(linha3, 9) = "DEF 01> PBF > Metal > 2"
    Cells(linha3, 10) = "DEF 01> PBF > Metal > 2"
    Cells(linha3, 11) = "DEF 01> PBF > Metal > 2"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "2" Then
    Cells(Linha4, 6) = "DEF 01> PBF > Metal > 2"
    Cells(Linha4, 7) = "DEF 01> PBF > Metal > 2"
    Cells(Linha4, 8) = "DEF 01> PBF > Metal > 2"
    Cells(Linha4, 9) = "DEF 01> PBF > Metal > 2"
    Cells(Linha4, 12) = "DEF 01> PBF > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "2" Then
    Cells(Linha5, 9) = "DEF 01> PBF > Metal > 2"
    Cells(Linha5, 10) = "DEF 01> PBF > Metal > 2"
    Cells(Linha5, 11) = "DEF 01> PBF > Metal > 2"
    Cells(Linha5, 12) = "DEF 01> PBF > Metal > 2"
End If
'Fim Da Complexidade 2 - Metálicos

'Complexidade 3 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "3" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "3" Then
    Cells(linha, 6) = "DEF 01> PBF > Metal > 3"
    Cells(linha, 8) = "DEF 01> PBF > Metal > 3"
    Cells(linha, 9) = "DEF 01> PBF > Metal > 3"
    Cells(linha, 10) = "DEF 01> PBF > Metal > 3"
    Cells(linha, 11) = "DEF 01> PBF > Metal > 3"
    Cells(linha, 12) = "DEF 01> PBF > Metal > 3"
    Cells(linha, 13) = "DEF 01> PBF > Metal > 3"
    Cells(linha, 14) = "DEF 01> PBF > Metal > 3"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "3" Then
    Cells(linha2, 7) = "DEF 01> PBF > Metal > 3"
    Cells(linha2, 8) = "DEF 01> PBF > Metal > 3"
    Cells(linha2, 9) = "DEF 01> PBF > Metal > 3"
    Cells(linha2, 10) = "DEF 01> PBF > Metal > 3"
    Cells(linha2, 11) = "DEF 01> PBF > Metal > 3"
    Cells(linha2, 13) = "DEF 01> PBF > Metal > 3"
    Cells(linha2, 14) = "DEF 01> PBF > Metal > 3"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "3" Then
    Cells(linha3, 7) = "DEF 01> PBF > Metal > 3"
    Cells(linha3, 8) = "DEF 01> PBF > Metal > 3"
    Cells(linha3, 9) = "DEF 01> PBF > Metal > 3"
    Cells(linha3, 10) = "DEF 01> PBF > Metal > 3"
    Cells(linha3, 11) = "DEF 01> PBF > Metal > 3"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 3"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "3" Then
    Cells(Linha4, 6) = "DEF 01> PBF > Metal > 3"
    Cells(Linha4, 7) = "DEF 01> PBF > Metal > 3"
    Cells(Linha4, 8) = "DEF 01> PBF > Metal > 3"
    Cells(Linha4, 9) = "DEF 01> PBF > Metal > 3"
    Cells(Linha4, 12) = "DEF 01> PBF > Metal > 3"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "3" Then
    Cells(Linha5, 9) = "DEF 01> PBF > Metal > 3"
    Cells(Linha5, 10) = "DEF 01> PBF > Metal > 3"
    Cells(Linha5, 11) = "DEF 01> PBF > Metal > 3"
    Cells(Linha5, 12) = "DEF 01> PBF > Metal > 3"
End If
'Fim Da Complexidade 3 - Metálicos

'Complexidade 4 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "4" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "4" Then
    Cells(linha, 6) = "DEF 01> PBF > Metal > 4"
    Cells(linha, 8) = "DEF 01> PBF > Metal > 4"
    Cells(linha, 9) = "DEF 01> PBF > Metal > 4"
    Cells(linha, 10) = "DEF 01> PBF > Metal > 4"
    Cells(linha, 11) = "DEF 01> PBF > Metal > 4"
    Cells(linha, 12) = "DEF 01> PBF > Metal > 4"
    Cells(linha, 13) = "DEF 01> PBF > Metal > 4"
    Cells(linha, 14) = "DEF 01> PBF > Metal > 4"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "4" Then
    Cells(linha2, 7) = "DEF 01> PBF > Metal > 4"
    Cells(linha2, 8) = "DEF 01> PBF > Metal > 4"
    Cells(linha2, 9) = "DEF 01> PBF > Metal > 4"
    Cells(linha2, 10) = "DEF 01> PBF > Metal > 4"
    Cells(linha2, 11) = "DEF 01> PBF > Metal > 4"
    Cells(linha2, 13) = "DEF 01> PBF > Metal > 4"
    Cells(linha2, 14) = "DEF 01> PBF > Metal > 4"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "4" Then
    Cells(linha3, 7) = "DEF 01> PBF > Metal > 4"
    Cells(linha3, 8) = "DEF 01> PBF > Metal > 4"
    Cells(linha3, 9) = "DEF 01> PBF > Metal > 4"
    Cells(linha3, 10) = "DEF 01> PBF > Metal > 4"
    Cells(linha3, 11) = "DEF 01> PBF > Metal > 4"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 4"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "4" Then
    Cells(Linha4, 6) = "DEF 01> PBF > Metal > 4"
    Cells(Linha4, 7) = "DEF 01> PBF > Metal > 4"
    Cells(Linha4, 8) = "DEF 01> PBF > Metal > 4"
    Cells(Linha4, 9) = "DEF 01> PBF > Metal > 4"
    Cells(Linha4, 12) = "DEF 01> PBF > Metal > 4"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "4" Then
    Cells(Linha5, 9) = "DEF 01> PBF > Metal > 4"
    Cells(Linha5, 10) = "DEF 01> PBF > Metal > 4"
    Cells(Linha5, 11) = "DEF 01> PBF > Metal > 4"
    Cells(Linha5, 12) = "DEF 01> PBF > Metal > 4"
End If
'Fim Da Complexidade 4 - Metálicos PBF

'Inicio da Complexidade - Metálicos DED

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "DEF 01> DED > Metal > 1"
    Cells(linha, 8) = "DEF 01> DED > Metal > 1"
    Cells(linha, 9) = "DEF 01> DED > Metal > 1"
    Cells(linha, 10) = "DEF 01> DED > Metal > 1"
    Cells(linha, 11) = "DEF 01> DED > Metal > 1"
    Cells(linha, 12) = "DEF 01> DED > Metal > 1"
    Cells(linha, 13) = "DEF 01> DED > Metal > 1"
    Cells(linha, 14) = "DEF 01> DED > Metal > 1"

End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "DEF 01> DED > Metal > 1"
    Cells(linha2, 8) = "DEF 01> DED > Metal > 1"
    Cells(linha2, 9) = "DEF 01> DED > Metal > 1"
    Cells(linha2, 10) = "DEF 01> DED > Metal > 1"
    Cells(linha2, 11) = "DEF 01> DED > Metal > 1"
    Cells(linha2, 13) = "DEF 01> DED > Metal > 1"
    Cells(linha2, 14) = "DEF 01> DED > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "DEF 01> DED > Metal > 1"
    Cells(linha3, 8) = "DEF 01> DED > Metal > 1"
    Cells(linha3, 9) = "DEF 01> DED > Metal > 1"
    Cells(linha3, 10) = "DEF 01> DED > Metal > 1"
    Cells(linha3, 11) = "DEF 01> DED > Metal > 1"
    Cells(linha3, 13) = "DEF 01> DED > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "DEF 01> DED > Metal > 1"
    Cells(Linha4, 7) = "DEF 01> DED > Metal > 1"
    Cells(Linha4, 8) = "DEF 01> DED > Metal > 1"
    Cells(Linha4, 9) = "DEF 01> DED > Metal > 1"
    Cells(Linha4, 12) = "DEF 01> DED > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "DEF 01> DED > Metal > 1"
    Cells(Linha5, 10) = "DEF 01> DED > Metal > 1"
    Cells(Linha5, 11) = "DEF 01> DED > Metal > 1"
    Cells(Linha5, 12) = "DEF 01> DED > Metal > 1"
End If

'Complexidade 2 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "2" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "2" Then
    Cells(linha, 6) = "DEF 01> DED > Metal > 2"
    Cells(linha, 8) = "DEF 01> DED > Metal > 2"
    Cells(linha, 9) = "DEF 01> DED > Metal > 2"
    Cells(linha, 10) = "DEF 01> DED > Metal > 2"
    Cells(linha, 11) = "DEF 01> DED > Metal > 2"
    Cells(linha, 12) = "DEF 01> DED > Metal > 2"
    Cells(linha, 13) = "DEF 01> DED > Metal > 2"
    Cells(linha, 14) = "DEF 01> DED > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "2" Then
    Cells(linha2, 7) = "DEF 01> DED > Metal > 2"
    Cells(linha2, 8) = "DEF 01> DED > Metal > 2"
    Cells(linha2, 9) = "DEF 01> DED > Metal > 2"
    Cells(linha2, 10) = "DEF 01> DED > Metal > 2"
    Cells(linha2, 11) = "DEF 01> DED > Metal > 2"
    Cells(linha2, 13) = "DEF 01> DED > Metal > 2"
    Cells(linha2, 14) = "DEF 01> DED > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "2" Then
    Cells(linha3, 7) = "DEF 01> DED > Metal > 2"
    Cells(linha3, 8) = "DEF 01> DED > Metal > 2"
    Cells(linha3, 9) = "DEF 01> DED > Metal > 2"
    Cells(linha3, 10) = "DEF 01> DED > Metal > 2"
    Cells(linha3, 11) = "DEF 01> DED > Metal > 2"
    Cells(linha3, 13) = "DEF 01> DED > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "2" Then
    Cells(Linha4, 6) = "DEF 01> DED > Metal > 2"
    Cells(Linha4, 7) = "DEF 01> DED > Metal > 2"
    Cells(Linha4, 8) = "DEF 01> DED > Metal > 2"
    Cells(Linha4, 9) = "DEF 01> DED > Metal > 2"
    Cells(Linha4, 12) = "DEF 01> DED > Metal > 2"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "2" Then
    Cells(Linha5, 9) = "DEF 01> DED > Metal > 2"
    Cells(Linha5, 10) = "DEF 01> DED > Metal > 2"
    Cells(Linha5, 11) = "DEF 01> DED > Metal > 2"
    Cells(Linha5, 12) = "DEF 01> DED > Metal > 2"
End If
'Fim Da Complexidade 2 - Metálicos

'Complexidade 3 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "3" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "3" Then
    Cells(linha, 6) = "DEF 01> DED > Metal > 3"
    Cells(linha, 8) = "DEF 01> DED > Metal > 3"
    Cells(linha, 9) = "DEF 01> DED > Metal > 3"
    Cells(linha, 10) = "DEF 01> DED > Metal > 3"
    Cells(linha, 11) = "DEF 01> DED > Metal > 3"
    Cells(linha, 12) = "DEF 01> DED > Metal > 3"
    Cells(linha, 13) = "DEF 01> DED > Metal > 3"
    Cells(linha, 14) = "DEF 01> DED > Metal > 3"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "3" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "3" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "3" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "3" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 3 - Metálicos

'Complexidade 4 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "4" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "4" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "4" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "4" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "4" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "DED" And Cells(linha, 4) = "4" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If

'Fim da Complexidade - Metálicos DED

'Inicio da Complexidade - Metálicos Binder Jetting

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If

'Complexidade 2 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "2" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "2" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "2" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "2" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "2" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "2" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 2 - Metálicos

'Complexidade 3 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "3" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "3" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "3" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "3" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "3" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "3" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 3 - Metálicos

'Complexidade 4 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "4" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "4" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "4" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "4" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "4" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Binder Jetting" And Cells(linha, 4) = "4" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim da Complexidade - Metálicos Binder Jetting

'Inicio da Complexidade - Metálicos Material Extrusion

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Complexidade 2 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "2" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "2" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "2" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "2" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "2" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "2" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 2 - Metálicos

'Complexidade 3 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "3" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "3" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "3" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "3" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "3" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "3" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 3 - Metálicos

'Complexidade 4 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "4" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "4" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "4" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "4" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "4" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Extrusion" And Cells(linha, 4) = "4" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim da Complexidade - Metálicos Binder Jetting

'Inicio da Complexidade - Metálicos Sheet Lamination

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"

End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Complexidade 2 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "2" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "2" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "2" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "2" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "2" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "2" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 2 - Metálicos

'Complexidade 3 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "3" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "3" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "3" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "3" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "3" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "3" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 3 - Metálicos

'Complexidade 4 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "4" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "4" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "4" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "4" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "4" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Sheet Lamination" And Cells(linha, 4) = "4" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim da Complexidade - Metálicos Sheet Lamination

'Inicio da Complexidade - Metálicos Material Jetting

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"

End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Complexidade 2 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "2" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "2" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "2" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "2" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "2" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "2" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 2 - Metálicos

'Complexidade 3 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "3" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "3" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "3" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "3" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "3" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "3" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If
'Fim Da Complexidade 3 - Metálicos

'Complexidade 4 - Metálicos

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "4" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "4" Then
    Cells(linha, 6) = "X"
    Cells(linha, 8) = "X"
    Cells(linha, 9) = "X"
    Cells(linha, 10) = "X  (Perpendiculares)"
    Cells(linha, 11) = "X"
    Cells(linha, 12) = "X"
    Cells(linha, 13) = "X  (ferromagnéticos)"
    Cells(linha, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "4" Then
    Cells(linha2, 7) = "X"
    Cells(linha2, 8) = "X"
    Cells(linha2, 9) = "X"
    Cells(linha2, 10) = "X  (Perpendiculares)"
    Cells(linha2, 11) = "X"
    Cells(linha2, 13) = "X  (ferromagnéticos)"
    Cells(linha2, 14) = "X"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "4" Then
    Cells(linha3, 7) = "X"
    Cells(linha3, 8) = "X"
    Cells(linha3, 9) = "X"
    Cells(linha3, 10) = "X"
    Cells(linha3, 11) = "X"
    Cells(linha3, 13) = "X  (ferromagnéticos)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "4" Then
    Cells(Linha4, 6) = "X (Externas)"
    Cells(Linha4, 7) = "X"
    Cells(Linha4, 8) = "X"
    Cells(Linha4, 9) = "X"
    Cells(Linha4, 12) = "X (Externas)"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "Material Jetting" And Cells(linha, 4) = "4" Then
    Cells(Linha5, 9) = "X"
    Cells(Linha5, 10) = "X"
    Cells(Linha5, 11) = "X"
    Cells(Linha5, 12) = "X"
End If

'Fim da Complexidade - Metálicos Sheet Lamination
'Fim dos Materiais Metálicos
End Sub


Can someone help me getting code shorter or other option?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi & welcome to MrExcel.
All the lf statements that start
Excel Formula:
If Cells(linha, 2) = "Metálicos"
are being repeated multiple times. Getting rid of the duplicates will shorten the code.
 
Upvote 0
Hi & welcome to MrExcel.
All the lf statements that start
Excel Formula:
If Cells(linha, 2) = "Metálicos"
are being repeated multiple times. Getting rid of the duplicates will shorten the code.

So i take out all the If's only remain one and change with what?
 

Attachments

  • 1625146303153.png
    1625146303153.png
    1.6 KB · Views: 4
Upvote 0
I did not say to remove all the ifs, just the duplicated ones, for instance all these are checking the same value
VBA Code:
If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 12) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 13) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 14) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 13) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 14) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 7) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 8) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 9) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 12) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 10) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 11) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 12) = "DEF 01> PBF > Metal > 1"
End If
Just keep one of them & remove the rest.
 
Upvote 0
So i take out all the If's only remain one and change with what?
And the c
I did not say to remove all the ifs, just the duplicated ones, for instance all these are checking the same value
VBA Code:
If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then '<------------- Condição, variável linha e a respetiva coluna da folha
    Cells(linha, 5) = "Microfissuras Superficiais"
    Cells(linha2, 5) = "Microfissuras Internas"
    Cells(linha3, 5) = "Microporosidades(Internas)"
    Cells(Linha4, 5) = "Inclusões"
    Cells(Linha5, 5) = "Oxidação"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha, 6) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 12) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 13) = "DEF 01> PBF > Metal > 1"
    Cells(linha, 14) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha2, 7) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 13) = "DEF 01> PBF > Metal > 1"
    Cells(linha2, 14) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 8) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 9) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 10) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 11) = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(Linha4, 6) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 7) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 8) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 9) = "DEF 01> PBF > Metal > 1"
    Cells(Linha4, 12) = "DEF 01> PBF > Metal > 1"
End If

If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(Linha5, 9) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 10) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 11) = "DEF 01> PBF > Metal > 1"
    Cells(Linha5, 12) = "DEF 01> PBF > Metal > 1"
End If
Just keep one of them & remove the rest.
I think its because i need 3 conditions in that case Type of material, The Test and the complexity= 1
And that is on the table for each line
So when 3 conditions meet it auto completes the rest of the table
1625146954997.png

So each linha represents a row that's why i think i did that correct me if im wrong and thank you
 
Upvote 0
You have merged cells in there, get rid of them, they are an abomination & should be avoided like the plague.

Also what is the point in doing exactly the same test multiple times? Just do it once & input the correct details.
 
Upvote 0
You have merged cells in there, get rid of them, they are an abomination & should be avoided like the plague.

Also what is the point in doing exactly the same test multiple times? Just do it once & input the correct details.
For example
If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
Cells(linha, 6) = "DEF 01> PBF > Metal > 1"
Cells(linha, 8) = "DEF 01> PBF > Metal > 1"
Cells(linha, 9) = "DEF 01> PBF > Metal > 1"
Cells(linha, 10) = "DEF 01> PBF > Metal > 1"
Cells(linha, 11) = "DEF 01> PBF > Metal > 1"
Cells(linha, 12) = "DEF 01> PBF > Metal > 1"
Cells(linha, 13) = "DEF 01> PBF > Metal > 1"
Cells(linha, 14) = "DEF 01> PBF > Metal > 1"
End If
It is for the first row all columns complexity=1
The other ones that are the same is for next row 9,10,11 and 12 to fill other ones
 
Upvote 0
As linha is not changed you are only checking row 8 for those values, therefore checking the exact same cells for the exact same values multiple times is totally & utterly pointless.
 
Upvote 0
1625149028663.png

As linha is not changed you are only checking row 8 for those values, therefore checking the exact same cells for the exact same values multiple times is totally & utterly pointless.
If i only keep 1 line it happens that...
 
Upvote 0
That makes no sense. What happens?
 
Upvote 0

Forum statistics

Threads
1,215,402
Messages
6,124,708
Members
449,182
Latest member
mrlanc20

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top