+ Reply to Thread
Results 1 to 5 of 5

Need help with my sum check code

  1. #1
    Registered User
    Join Date
    12-11-2013
    Location
    nyc
    MS-Off Ver
    M365 V2311
    Posts
    65

    Need help with my sum check code

    Hello,

    I am trying to do a sum check here and below is what I put:

    Sub exercise()

    ' sum check
    If Application.WorksheetFunction.Abs(Sum(Range("A:A"))) > 0.001 Then
    MsgBox ("Good to Go")
    Else
    MsgBox ("Failed")
    End If

    End Sub

    I basically want to make sure the absolute value of the sum result to be less than 0.001

    Any help is appreciated.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need help with my sum check code

    Hi please use the code markers when placing code without the spaces are is just to show the code separator
    [ code ]


    [ / code ]

    code goes here

    Please Login or Register  to view this content.
    And what is exactly your question? absolute value? ABS(the value) returns the absolute value but what do you mean with the question?
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    12-11-2013
    Location
    nyc
    MS-Off Ver
    M365 V2311
    Posts
    65

    Re: Need help with my sum check code

    Apologize for the confusion, I want to do a sum check on column A to make sure the sum result is less than 0.0001 and more than -0.0001

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need help with my sum check code

    You can never compare an absolute value < or > than since an absolute value is that no negative
    So just compare if the sum range if it's in between those values or outside, so >= <= or similar.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need help with my sum check code

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using Check Box Code for Multiple Check Boxes
    By brentjohn in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-07-2018, 01:13 AM
  2. [SOLVED] VBA Code to Check if a Range of cells is Empty or Not and run code accordingly
    By unit285 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-01-2016, 08:19 PM
  3. How to check if excel file is Checked Out in SharePoing Check Out, run code, Check In
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-08-2016, 04:36 PM
  4. [SOLVED] Code to check check box
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2014, 02:50 PM
  5. I need a code for presence check to check multiple text boxes and combo boxes
    By Lee_wwfc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2013, 01:53 PM
  6. [SOLVED] Vba code to fill check in & check out counts
    By ashfaquebwd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2013, 09:02 AM
  7. [SOLVED] vba code to be correct and check ,vba code to brig data for the same refreince
    By funtastic in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-25-2012, 02:29 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1