Consulting

Results 1 to 7 of 7

Thread: Autosum current column in a table

  1. #1

    Autosum current column in a table

    Hi...

    My current activecell is one of the cells in the Totals row in a table, i have so many tables with different row count so the "FormulaR1C1" method is not working for me cause each time the values are different, i am looking for a code to enable me to autosum the whole column of the table.

    Each table is in a separate workbook and all of them are named "Table1".

    I Can manage to select the right cell in each table with my current code, but i cant autosum this column.

    what i need is something like this, for example:

    1. application.activecell.sum(thiscolumn)!

    2. activecell=sum(thiscolumn)

    On the other hand i have 2 cells (BQ6 & BQ7) which have the right First and Last cell to sum as text i.e" cell BQ6 has the text "E3" and cell BQ7 has the text "E8", and the right cell range i need to sum is actually E3:E8, so i tried this code and it didn't work:
    Dim i as Range
    Dim b as Range
    Set i = Range(Range("BQ5").Value)
    Set b = Range(Range("BQ6").Value)
    ActiveCell.FormulaR1C1="=Sum(i:b)"
    Thank you so much...

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If it's a table, why don't you just add a Table Totals row, let Excel manage it for you.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    I actually added a Totals Row but how can i tell excel which Column to Sum?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You can go into each Totals cell, and click the dropdown arrow at the side. There is a None option.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    I HAVE HUNDREDS OF TABLES AND AFTER THE CODE RUNS IN EACH ONE OF THEM IT WILL PRINT THE TABLE OUT SO I NEED ONLY TO SELECT SPECIFIC COLUMNS TO SUM, ITS A BUSINESS REPORT AND I CANT HAVE ERRORS AND SUMS FOR UNNECESSARY DATA LIKE A COLUMN FOR DATE OR SERIAL NUMBER.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    WELL SHOUTING AT ME ISN'T GOING TO HELP ANYTHING!
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Hopefully that was only an accident...
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

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
  •