account123

New Member
Joined
Oct 1, 2016
Messages
11
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...
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Summing a field from a Table.
Code:
=Sum(TableName[FieldName])
 
Upvote 0
thats looks good but the FieldName is different in every table, i can insert the correct field name in cell BQ8 but then i need o declare it at somethimg? i guess
 
Upvote 0
The Field name will always be the header name from the table.
Like tables would be best using like headers simplifying those relationships.
 
Upvote 0
thats looks good but the FieldName is different in every table, i can insert the correct field name in cell BQ8 but then i need o declare it at somethimg? i guess
Code:
BQRef= Range("BQ8").value
 ActiveCell.FormulaR1C1="=Sum(TableName,["&BQRef&"])"
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,478
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top