Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Link a macro to a cell value

I have a workbook with a varying number of worksheets.

Each sheet has a "sheet total" cell that sums a range
of "quantity" cells. The first worksheet has a "project
total", which will contain the sum ot the sheet totals for
the entire workbook. I have the function for that task.

I'd like the "project total" function (macro) to run
whenever any of the "sheet total" values change.

how do I associate the macro to that event?

Thanks in advance,
Rich
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Link a macro to a cell value

Hi Rich,
As I understand your question your master sheet shows only one
total from the other sheets -- no individual sheet totals.
You will have to be able to find those totals; hopefully, they
are in the same location on each worksheet.

You would use a Calculate event
http://www.mvps.org/dmcritchie/excel/event.htm

You might be able to eliminate use of a macro entirely if
you can use a 3-D total see Excel Help, Answer wizard: 3-D sum
one such topic you will find is (you can use 3D or 3-D in the above search)
Refer to the same cell or range on multiple sheets by using a 3-D reference.

Things you do not mention. Adding additional worksheets, is the sum
on the same location on each sheet.

You might also take a look at
http://www.mvps.org/dmcritchie/excel/buildtoc2.htm
which handles pulling off descriptions and totals from specific
locations of named worksheets. Don't think it applies to your
request but you might find it interesting for related usage.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Rich" wrote in message ...
I have a workbook with a varying number of worksheets.

Each sheet has a "sheet total" cell that sums a range
of "quantity" cells. The first worksheet has a "project
total", which will contain the sum ot the sheet totals for
the entire workbook. I have the function for that task.

I'd like the "project total" function (macro) to run
whenever any of the "sheet total" values change.

how do I associate the macro to that event?

Thanks in advance,
Rich



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Link a macro to a cell value

Why are you using a macro for anything?

Assuming that the individual sheets have their total in cell C28, on
the summary worksheet, use =SUM(Sheet1:Sheet10!C28)

where Sheet1 and Sheet10 are the first and last worksheets of interest
to you.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I have a workbook with a varying number of worksheets.

Each sheet has a "sheet total" cell that sums a range
of "quantity" cells. The first worksheet has a "project
total", which will contain the sum ot the sheet totals for
the entire workbook. I have the function for that task.

I'd like the "project total" function (macro) to run
whenever any of the "sheet total" values change.

how do I associate the macro to that event?

Thanks in advance,
Rich

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Link a macro to a cell value

The number of worksheets will vary from workbook to
workbook.

As for "macros", perhaps I mis-use the term, but I can run
the functions from the "macro" dialog, if I desire...

Rich
-----Original Message-----
Why are you using a macro for anything?

Assuming that the individual sheets have their total in

cell C28, on
the summary worksheet, use =SUM(Sheet1:Sheet10!C28)

where Sheet1 and Sheet10 are the first and last

worksheets of interest
to you.

--
Regards,

Tushar Mehta, MS MVP -- Excel


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Link a macro to a cell value

It doesn't matter if the number of sheets vary. Just use two dummy
sheets, say SheetFirst and SheetLast. Put all other other sheets in
between these two. Your formula should be
=SUM(SheetFirst:SheetLast!C28)

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
The number of worksheets will vary from workbook to
workbook.

As for "macros", perhaps I mis-use the term, but I can run
the functions from the "macro" dialog, if I desire...

Rich
-----Original Message-----
Why are you using a macro for anything?

Assuming that the individual sheets have their total in

cell C28, on
the summary worksheet, use =SUM(Sheet1:Sheet10!C28)

where Sheet1 and Sheet10 are the first and last

worksheets of interest
to you.

--
Regards,

Tushar Mehta, MS MVP -- Excel





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
I want to link a cell in the macro [email protected] Excel Discussion (Misc queries) 1 April 9th 07 06:30 AM
if i sort cell that has link to another page how to keep link steve Bahrain Excel Discussion (Misc queries) 1 August 16th 06 01:20 PM
if i sort cell that has link to another page how to keep link steve Bahrain Excel Discussion (Misc queries) 0 August 16th 06 07:37 AM
using macro that will link into web Conditional Formatting Excel Discussion (Misc queries) 0 May 11th 06 11:25 PM
Link macro to a toolbar? Lars Peter Nielsen Excel Programming 1 August 21st 03 09:22 PM


All times are GMT +1. The time now is 09:40 AM.

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

About Us

"It's about Microsoft Excel"