View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default entering formula using cells notation

cells(k+l,19).formula="=R1C1/R2C2"

results in formula with absolute referencing =$A$1/$B$2 in cell (k+l,19).

Is this what you want?

Regards,
Stefi

€˛Stefi€¯ ezt Ć*rta:

What you are looking for is probably FormulaR1C1 style referencing (e.g.
Cells(8, 19).FormulaR1C1 ="RC[1]/RC[2]" results in =T8/U8, but

Cells(k + l, 19).Formula = "=cells(k+l,19)/cells(k,19)"

would be a circular reference: Cells(k + l, 19) cannot reference to itself,

so specify a correct formula!

Regards,
Stefi

€˛jk22€¯ ezt Ć*rta:

Hi - I am trying to write the following in a macro in excel

For k = 8 to 1000
.......
For l = 1 To 50
If Cells(k + l, 2) < "" Then
Cells(k + l, 19).Formula = "=cells(k+l,19)/cells(k,19)" - does not
work in xls
Cells(k + l, 20).Formula = "=A1/B2" -
works in xls
End If
Next
.........

Can anyone suggest how to do this in loops?