Consulting

Results 1 to 3 of 3

Thread: Solved: VBA IF statement condition issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Solved: VBA IF statement condition issue

    I have a VB if statement that compares a report total (Range("ShareTotal")) to a running total (ReportTotal) – each total goes out 4 decimal places. They both match (1,703,874,448.7524) but the if statement is performing the “else” condition – as if they don’t match. My only guess is it has to do with going out 4 decimals. I tried a number of different data types and they all act like the two don’t match. . Any insight?


    If Range("ShareTotal") = ReportTotal Then
    MsgBox "Omni Shares ** Matches ** EARS Extract" & Chr(13) & Chr(13) & " " & Format(ReportTotal, "#,##0.0000; (#,##0.0000)"), vbInformation, "Share Reconciliation Report"
    Else
    MsgBox "Omni Shares ** Does Not Match ** EARS Extract" & Chr(13) & Chr(13) & " Difference: " & Format(ReportTotal - Range("ShareTotal").Value, "#,##0.0000; (#,##0.0000)"), vbCritical, "Share Reconciliation Report"
    End If

    Last edited by Aussiebear; 03-30-2023 at 03:42 PM. Reason: Added code tags

Posting Permissions

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