Results 1 to 6 of 6

Table column sum generates error

Threaded View

  1. #1
    Registered User
    Join Date
    04-04-2018
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS 365
    Posts
    34

    Table column sum generates error

    I have a worksheet containing a table. The following function returns the total of any column.

    Function ColSum(col As Integer)
    
        Dim lo As ListObject
        Dim TotalSP As Integer
        
        
        Application.Volatile
        
        Sheets("ContractAuth").Activate
        Set lo = ActiveSheet.ListObjects(1)
        ColSum = Application.WorksheetFunction.Sum(lo.DataBodyRange.Columns(col))
        
    End Function
    I find that often the cell holding the result of this function has the error '#VALUE' and I have to press F9 to force calculation, although automatic calculation is already on. This appears to happen when a change is made to another worksheet in the same workbook - I have to return to the worksheet containing the table and press F9.
    Last edited by DougieJLockhart; 05-02-2018 at 05:29 AM. Reason: More information

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Refresh pivot table generates run time error
    By Mskrn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2016, 11:59 PM
  2. set variable to 0 if a function generates an error
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-03-2016, 08:43 PM
  3. how to exit a sub if it generates an error
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2015, 03:34 PM
  4. [SOLVED] Code generates 400 error
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2014, 02:33 AM
  5. VBA generates error 13
    By jmafabi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2012, 11:04 AM
  6. Macro generates error '5'
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2009, 04:17 PM
  7. Working application - Now generates error
    By Madiya in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-24-2005, 07:38 AM

Tags for this Thread

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