ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting a formula in cell on a totals sheet using VB (https://www.excelbanter.com/excel-programming/288316-setting-formula-cell-totals-sheet-using-vbulletin.html)

JAllen3023

setting a formula in cell on a totals sheet using VB
 
Need Help,

I have a Totals sheet with several worksheets that represent projects. The
number of worksheets(projects) will be added or deleted depending on project
completions.

What I'm trying to do is have a Macro to run that will count the number of
worksheets (since the number is not constant) and force the formula -
+ 'sheetName" !B2 + 'sheetName' !B2 - into cell B2 on the Totals sheet.
Can anyone help

Ron de Bruin

setting a formula in cell on a totals sheet using VB
 
Try this

Add two dummy sheets(empty sheets)with the name start as the first sheet
and one with the name end as the last sheet of your workbook.
this are empty sheets!!!

All worksheets between these sheets will be sum
with this formula

=SUM(start:end!B2)


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"JAllen3023" wrote in message ...
Need Help,

I have a Totals sheet with several worksheets that represent projects. The
number of worksheets(projects) will be added or deleted depending on project
completions.

What I'm trying to do is have a Macro to run that will count the number of
worksheets (since the number is not constant) and force the formula -
+ 'sheetName" !B2 + 'sheetName' !B2 - into cell B2 on the Totals sheet.
Can anyone help




Andy

setting a formula in cell on a totals sheet using VB
 
This file might be a help:
http://www.bygsoftware.com/examples/zipfiles/consol.zip
It's in the "Accountants" section on page:
http://www.bygsoftware.com/examples/examples.htm

The "Bread-Roll" consolidation method - great for accountants. See how
simple it is to consolidate any combination of your organisation's accounts.
(No VBA used)


--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"



"JAllen3023" wrote in message
...
Need Help,

I have a Totals sheet with several worksheets that represent projects. The
number of worksheets(projects) will be added or deleted depending on

project
completions.

What I'm trying to do is have a Macro to run that will count the number of
worksheets (since the number is not constant) and force the formula -
+ 'sheetName" !B2 + 'sheetName' !B2 - into cell B2 on the Totals sheet.
Can anyone help




Bernard GINESTE

setting a formula in cell on a totals sheet using VB
 
Hello,

Sub test()
somme = 0
For Each f In ActiveWorkbook.Worksheets
somme = somme + f.Cells(2, 2) ' B2
Next
MsgBox somme
End Sub

Good luck !

BG




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com