Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use of Indirect function
Hi,
I'm trying to sum the same cell across a number of worksheets using the following formula =SUM(aaa:bbb!C1) where aaa is the name of the first sheet, bbb is the name of the last sheet and C1 is the cell being summed... this works - but what I want to do is replace bbb with a variable using the INDIRECT function. This means that I can add sheets onto the end of the workbook (using VBA) and by updating a single cell (again using VBA) all the SUM formulas will now add through to the final sheet. Can't get the syntax to work....any help appreciated Rgds....Chris |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use of Indirect function
Hi Chris;
You can use the paste special method and add the values without using any functions or formulas. Here is an example: Sub try() Sheets("SourceSheet").Select Range("A1:B4").Select Selection.Copy Sheets("ResultsSheet").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _ :=False, Transpose:=False End Sub Thanks, Greg -----Original Message----- Hi, I'm trying to sum the same cell across a number of worksheets using the following formula =SUM(aaa:bbb!C1) where aaa is the name of the first sheet, bbb is the name of the last sheet and C1 is the cell being summed... this works - but what I want to do is replace bbb with a variable using the INDIRECT function. This means that I can add sheets onto the end of the workbook (using VBA) and by updating a single cell (again using VBA) all the SUM formulas will now add through to the final sheet. Can't get the syntax to work....any help appreciated Rgds....Chris . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use of Indirect function
Easier is to keep a blank sheet as the last sheet and insert any new sheets
before that, then you can do =Sum(aaa:last!C1) and not have to make an adjustment. -- Regards, Tom Ogilvy "Chris Gorham" wrote in message ... Hi, I'm trying to sum the same cell across a number of worksheets using the following formula =SUM(aaa:bbb!C1) where aaa is the name of the first sheet, bbb is the name of the last sheet and C1 is the cell being summed... this works - but what I want to do is replace bbb with a variable using the INDIRECT function. This means that I can add sheets onto the end of the workbook (using VBA) and by updating a single cell (again using VBA) all the SUM formulas will now add through to the final sheet. Can't get the syntax to work....any help appreciated Rgds....Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Indirect function | Excel Worksheet Functions | |||
Using INDIRECT Function and INDEX Function | Excel Discussion (Misc queries) | |||
INDIRECT function | Excel Worksheet Functions | |||
Indirect function help please | Excel Worksheet Functions | |||
INDIRECT function inside AND function | Excel Worksheet Functions |