Consulting

Results 1 to 2 of 2

Thread: vba module not reading the IF Statement

  1. #1

    Angry vba module not reading the IF Statement

    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

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •