PDA

View Full Version : [SOLVED] vba module not reading the IF Statement



camplucas
09-30-2014, 06:59 AM
I have a code inside my worksheet plan, and it works fine. However it is too long and I need to create a Module to continue writing the code. So I created a Public module and called it from the worksheet plan. The deal is, when I copy a working formula to the module, it stop working! I tried to go with interruption points and found out that they never consider both IF Statements as true. Have anyone experienced anything like this?


If Sheets("Serviços de Terceiros").Cells(i, c).Value = "Cim." Then
If Sheets("Serviços de Terceiros").Cells(i, d).Value = "Outros (Taxa)" Then
Sheets("Tabelas").Range("B15").Value = Sheets("Tabelas").Range("B15").Value + F4 * (A2 * Sheets("Serviços de Terceiros").Cells(i, 35).Value + A1 * Sheets("Serviços de Terceiros").Cells(i, 36).Value + A3 * Sheets("Serviços de Terceiros").Cells(i, 37).Value)
End If

snb
09-30-2014, 08:14 AM
With Sheets("Serviços de Terceiros")
if .Cells(i, c).Value = "Cim." and .Cells(i, d).Value = "Outros (Taxa)" Then Sheets("Tabelas").Range("B15")= Sheets("Tabelas").Range("B15") + .[F4] * (.[A2] * .Cells(i, 35) + .[A1] * .Cells(i, 36) + .[A3] * .Cells(i, 37))
End with