Thread
:
Increment value in a Formula
View Single Post
#
6
Posted to microsoft.public.excel.misc
Bernard Liengme[_2_]
external usenet poster
Posts: 563
Increment value in a Formula
A VBA solution with zero's blanked out;
First cell used formula =Dozen(A1) to sum the first block
Drag this to the right to make =Dozen(B1) to sum next block
etc....
Function dozen(myblock)
whatblock = (myblock.Column - 1) * 12
mystart = 1675 + whatblock
firstcell = "H" & mystart
mylast = 1686 + whatblock
lastcell = "J" & mylast
myrange = "Section3!" & firstcell & ":" & lastcell
dozen = WorksheetFunction.Sum(Range(myrange))
If dozen = 0 Then dozen = ""
End Function
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
"David Marr" <David
wrote in message
...
Hi,
I'm using Excel version 2003.
I have the following formula =IF(SUM('Section
3'!$H$1675:$J$1686)=0,"",SUM('Section 3'!$H$1675:$J$1686)) and would like
to
increment the cell references by 12.
I was wondering if there is a way to do this using a bit of VBA code?
So the result i'm looking for after code run is =IF(SUM('Section
3'!$H$1687:$J$1698)=0,"",SUM('Section 3'!$H$1687:$J$1698)).
I will be running the formula along the columns so will need to increment
the formula by 12 for each new column.
Thanks
Dave
Reply With Quote
Bernard Liengme[_2_]
View Public Profile
Find all posts by Bernard Liengme[_2_]