View Single Post
  #7   Report Post  
ChasX
 
Posts: n/a
Default

Thanks everybody for your timely help!
Chas.

"Arvi Laanemets" wrote:

Hi

Exit do is used to step out of loop before the ending condition is filled.
Like (this is an example only to demonstrate how it works):
....
i=2
Do Until i=1000
Activesheet.Range("C" & i).Formula = "=A" & i & "*B" & i
If ActiveSheet.Range("A" & i)=0 Then Exit Do
i=i+1
Loop
....

Btw. activating cells is time-consuming. Write formulas into cells by
reference only. P.e. you code may be:
....
i=0
Do Until ActiveCell.Offset(i,-2)="0"
ActiveCell.Offset(i,0)="=RC[-2]*RC[-1]"
i=i+1
Loop


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"ChasX" wrote in message
...
I am trying to obtain the product of column A and B and put it into column
C(axb=value in column C). There are 100 values in column A and B. I
set-up
the following but it stops after product(it doesn't loop):
Do Until ActiveCell.Offset(0,-2) = "0"
ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]"
ActiveCell.Offset(1,0).Select
Exit Do
Loop
Obviously I am new to VB and in need of assistance. W98SE,OfficeXP SBE.
Thankyou