View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
DaveO
 
Posts: n/a
Default Conditional Formating

Your Do loop would look something like this...

Sub CalcSum()

dim intCounter as integer

Do while len(Range("A" & intCounter).Text) 0 Or len(Range("B" &
intCounter).Text) 0

range("C" & intCounter).Formula = "=A" & intCounter &"+B" & intCounter

intCounter = intCounter + 1

Loop

End Sub

This assumes that the 2 fields you want are in column A and B. If not simply
alter in the code above.

HTH.


"Hru48" wrote:


Hey,

Just a quick question - Is there a way to tell excel that if a cell = 0
then don't print.

I am trying to figure out a way of summing two columns together and
putting the result in a third column, when I don't know how many cells
are populated everytime I do it.. its a monthly thing. I have a 'for'
loop so far where I have vaguly told it to sum up to 10000 as I know
the amount of rows will be less then this.. but i still end up with
alot of 0.

I know a DO ..until active cell is empty type loop would be better
though i'm not sure how to work this..

cheers for any suggestions


--
Hru48
------------------------------------------------------------------------
Hru48's Profile: http://www.excelforum.com/member.php...o&userid=24895
View this thread: http://www.excelforum.com/showthread...hreadid=507247