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?
 
That makes no sense. What happens?
When i have the other lines that u said to delete it fills the other lines of the table Microfissuras, Microporosidades, Inclusões, Oxidação like this:
1625149385329.png
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You need to amalgamate or the duplicated ifs into one & then then delete the duplicates.
Also you can rewrite this
VBA Code:
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
to
VBA Code:
If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7).Resize(, 5).Value = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 1"
End If
and the same sort of thing for the others.
 
Upvote 0
You need to amalgamate or the duplicated ifs into one & then then delete the duplicates.
Also you can rewrite this
VBA Code:
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
to
VBA Code:
If Cells(linha, 2) = "Metálicos" And Cells(linha, 3) = "PBF" And Cells(linha, 4) = "1" Then
    Cells(linha3, 7).Resize(, 5).Value = "DEF 01> PBF > Metal > 1"
    Cells(linha3, 13) = "DEF 01> PBF > Metal > 1"
End If
and the same sort of thing for the others.
1625150894375.png

It only fills this row
 
Upvote 0
That's because I only did it for one section, you will need to do it for all the others.
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,577
Members
449,039
Latest member
Arbind kumar

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