Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 25 of 25

Thread: Still Stuck On A loop

  1. #21
    VBAX Regular
    Joined
    Nov 2018
    Posts
    55
    Location
    Hi,

    The 10 value is what I was aiming for, which is the absolute value of the wrong counts. Right now, my code has it calculating the +/- difference. I tried using the absolute function (which worked for percentages) but not for counts. Sorry for late reply i went camping over the weekend.

  2. #22
    Knowledge Base Approver VBAX Guru
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    4,433
    try:
    Sub AudErrQuant2()
    'This functions calculates error int and counts
    With Worksheets("Generalized Report")
    For x = 6 To 10001
      If Sheets("Detail Report").Range("E" & x) = "Audit Error" Then
        RowNo = Range(Sheets("Detail Report").Range("A" & x)).Row
        .Range("A4").Value = .Range("A4").Value + Abs(Worksheets("Contract").Cells(RowNo, "G").Value - Worksheets("As Built").Cells(RowNo, "G").Value)
        .Range("B4").Value = .Range("B4").Value + Abs(Worksheets("Contract").Cells(RowNo, "I").Value - Worksheets("As Built").Cells(RowNo, "I").Value)
        .Range("C4").Value = .Range("C4").Value + Abs(Worksheets("Contract").Cells(RowNo, "J").Value - Worksheets("As Built").Cells(RowNo, "J").Value)
        .Range("D4").Value = .Range("D4").Value + Abs(Worksheets("Contract").Cells(RowNo, "K").Value - Worksheets("As Built").Cells(RowNo, "K").Value)
      End If
    Next x
    End With 'Worksheets("Generalized Report")
    End Sub
    p45cal - - - - -This is my signature, it appears after all my posts. Below is not directed at anyone in particular - so don't take offence! - (You might guess why it's there though)
    If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #23
    VBAX Regular
    Joined
    Nov 2018
    Posts
    55
    Location
    I see the difference in counts between mine and yours. Was my code calculating the +/- difference?

  4. #24
    Knowledge Base Approver VBAX Guru
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    4,433
    Quote Originally Posted by NWE View Post
    Was my code calculating the +/- difference?
    Yes.
    p45cal - - - - -This is my signature, it appears after all my posts. Below is not directed at anyone in particular - so don't take offence! - (You might guess why it's there though)
    If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #25
    VBAX Regular
    Joined
    Nov 2018
    Posts
    55
    Location
    Ok then, lessons learned. Thank you for ALL of your help sir!

Tags for this Thread

Posting Permissions

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