how to create farmula in excle programming

  • Thread starter Thread starter Guest
  • Start date Start date
If the cell or/and range is a variable, how to handle then?

Thanks at advance,
Viesta
 
Like this you mean:
Dim varRow As Variant
Dim varColumn As Variant
varRow = 15
varColumn = 25
Cells(varRow , varColumn ).Formula = "=..."
'Or
varColumn = "AB"
Range("a" & RowNumber & ":" & varColumn & "30").Formula = "=..."

NickHK
 
If it is the range to be summed that is variable, it would be situation
specific, but here is an example of one possible scenario for Sum.

set rng = range(Range("A1"),range("A1").end(xldown))
rng(rng.rows.count + 2).formula = "=Sum(" & rng.Address(1,1) & ")"

This puts a sum two rows below the last contiguous entry and sums the values
above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top