irisqueiroz
Member
Hi!
I´d like to right a code that when error ocuors then it should jump a part of the code and read another (On error GoTo), but when error doesn't ocuors then it shouldn't read that part of error treatment.
In this case, if error ocuors then go to "adicionar", if not then jump the "adicionar" part.
Thanks!
I´d like to right a code that when error ocuors then it should jump a part of the code and read another (On error GoTo), but when error doesn't ocuors then it shouldn't read that part of error treatment.
Code:
For i = 2 To uLinha
On Error GoTo adicionar
procurar = WorksheetFunction.Match(Sheets("Termos").Cells(i, 7), intervalo, 0)
Sheets("MtM").Cells(7, procurar) = Sheets("Termos").Cells(i, 20)
Sheets("MtM").Cells(5, procurar) = Sheets("Termos").Cells(i, 21)
adicionar:
cliente = Sheets("Termos").Cells(i, 5)
contrato = Sheets("Termos").Cells(i, 7)
ativo = Sheets("Termos").Cells(i, 15)
prazo = Sheets("Termos").Cells(i, 4)
dias = Sheets("Termos").Cells(i, 21)
Sheets("MtM").Cells(1, fimCol + 1) = cliente
Sheets("MtM").Cells(2, fimCol + 1) = contrato
Sheets("MtM").Cells(3, fimCol + 1) = ativo
Sheets("MtM").Cells(4, fimCol + 1) = prazo
Sheets("MtM").Cells(5, fimCol + 1) = dias
fimCol = fimCol + 1
Next
In this case, if error ocuors then go to "adicionar", if not then jump the "adicionar" part.
Thanks!