I have a worksheet containing a table. The following function returns the total of any column.
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.![]()
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
Bookmarks