Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Indirect function JD Excel Worksheet Functions 2 January 7th 10 03:34 AM
Using INDIRECT Function and INDEX Function ChristopherG Excel Discussion (Misc queries) 1 June 10th 09 04:07 PM
INDIRECT function Ernie Fenwick Excel Worksheet Functions 1 January 2nd 09 12:59 PM
Indirect function help please Guy[_2_] Excel Worksheet Functions 10 August 6th 07 11:06 AM
INDIRECT function inside AND function Biff Excel Worksheet Functions 3 September 23rd 06 07:20 PM


All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"