سؤال

I have a series of tables that all have names (i.e. they are named ranges). These tables add a series of numbers together and then provide a total in the very bottom right hand cell of the rectangular table. These tables are pasted into the document in different locations depending on where the user puts them.

So the question is, how do I, knowing the Name of each of these tables, extract the value of the totals cell in the bottom right hand corner of these tables and then add them together into a cell?

هل كانت مفيدة؟

المحلول

In the absence of any information about what you have tried already something like this should work:

Dim sumTotal as Integer
Dim NamedRange as Range
Set NamedRange = ActiveSheet.Range("NameOfRange")

'Find the Bottom Right Corner
sumTotal = sumTotal + NamedRange.Cells(1, 1).Offset(NamedRange.Rows.Count - 1, NamedRange.Columns.Count - 1).Value

'do this for each NamedRange

نصائح أخرى

If tables as in Insert > Tables - Table then with a formula such as:

=Table1[[#Totals],[sum]]+Table2[[#Totals],[sum]]+Table3[[#Totals],[sum]]  

SO20555364 example

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top