LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Dynamic add formula

Hi,

i have a worksheet with a dynamic number of columns, allways a
multiple of 7 columns.
The first column (A) contains the week number, then from column B on
starts the data, witch is a multiple of 7 columns wide. In my last 7
colums need i a formula to add the values from the previous data.
Example:
The formula need te be in cell P4 and is the sum of cell B4+I4 (see
offset from 7 columns each).
Because the number of data columns is dynamic, the add formula can be
also on W4 and is then the sum of B4+I4+P4

Any idea how to code this in a compact way?
I'm trying to write it in a select case (see below), but this isn't
realy dynamic
assume there are in a later stadia more columns needed, i have to
change the code, and i wan't to avoid that.

While DifferentUnitsInFamily 0
Select Case DifferentUnitsInFamily
Case 1
ActiveCell.FormulaR1C1 = "=SUM(RC[-7])"
Case 2
ActiveCell.FormulaR1C1 = "=SUM(RC[-14],RC[-7])"
Case 3
ActiveCell.FormulaR1C1 =
"=SUM(RC[-21],RC[-14],RC[-7])"


End Select

Any help apreciated,

Regards,
Ludo
 
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
How to convert a static formula to dynamic formula ? Pisistratus Excel Worksheet Functions 3 July 5th 07 01:54 PM
Dynamic Formula with Dynamic Address dmz_asdf Excel Worksheet Functions 7 December 15th 06 07:13 PM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Charts and Charting in Excel 0 March 1st 06 01:05 AM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Excel Programming 0 March 1st 06 01:05 AM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM


All times are GMT +1. The time now is 12:41 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"