+ Reply to Thread
Results 1 to 2 of 2

Excel VBA Table Column Sum

Hybrid View

  1. #1
    Registered User
    Join Date
    02-14-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    8

    Excel VBA Table Column Sum

    Hi Everyone,

    I've been stuck on this thing for hours and can't seem to find a way around it. I have created a sheet in vba that goes through another (parent) sheet, checks for values and then builds up 4 tables, one under the other, based on projects won, lost, on hold and on-going. I set these tables as Table1 , Table2, Table3, Table4... Issue is, I have to build a small summary table at the top of the sheet that shows the sums of each of these 4 tables..

    Everything is built in vba from scratch because the workbook/sheet is also created. I am using the following formula to calculate the sums of COLUMN6 from Table1 but the code is wrong.. I know it's something of the sort, but I cannot find the right format.

    wsO.Range("F4").Function = wsO.Application.WorksheetFunction.Sum("Table1[" & "Column6" & "]")

    Can you please help? I have pulled all my hair trying to figure this out.

    Reaaaallyy would appreciate it.

    Thanks!

  2. #2
    Registered User
    Join Date
    09-25-2013
    Location
    mars, IL
    MS-Off Ver
    Excel 2013
    Posts
    1

    Re: Excel VBA Table Column Sum

    I need to check a total to determine if a file should be created. I did the following:

    Dim balancedJeCheckRange As Variant
    Dim balancedJeCheck As Variant
    Dim sourceWorkbookName As String
    Dim sourceSheetName As String
    Dim sourceSheetName As String
    sourceWorkbookName = "WORKBOOK NAME"
    sourceWorkbookName = "WORKSHEET NAME"
    sourceWorkbookName = "TABLE NAME"

    Set balancedJeCheckRange = Workbooks(sourceWorkbookName).Sheets(sourceSheetName)
    Set balancedJeCheckRange = balancedJeCheckRange.ListObjects(sourceTableName)
    Set balancedJeCheckRange = balancedJeCheckRange.ListColumns("AMOUNT").Range
    balancedJeCheck = Application.WorksheetFunction.Sum(balancedJeCheckRange)
    balancedJeCheck = Application.WorksheetFunction.Round(balancedJeCheck, 2)

    I then check the value of balancedJeCheck to decide whether to right the file or not.
    You could also then assign it to a cell value.

    I find this easier then working out the quotes.

    I am could do this with fewer lines but did not need to from a performance perspective for my application.

    Hope this helps.

+ 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. Problem selecting Excel Table Column
    By asokaw in forum Excel General
    Replies: 5
    Last Post: 12-14-2013, 10:29 AM
  2. Replies: 3
    Last Post: 06-04-2013, 01:00 PM
  3. [SOLVED] Automatically create a column in one table from the totals column in another table
    By TravisRauch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2012, 02:56 PM
  4. Populatng a combobox from a column of a Excel Table
    By jgunders in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2012, 05:16 PM
  5. how do you renumber column in your excel table
    By N Locatis in forum Excel General
    Replies: 1
    Last Post: 03-03-2006, 05:25 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