ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to create farmula in excle programming (https://www.excelbanter.com/excel-programming/367057-how-create-farmula-excle-programming.html)

Ajaynagpur

how to create farmula in excle programming
 
how to create farmula in excle programming

NickHK

how to create farmula in excle programming
 
You mean:
Range("A1").Formula = "=SUM(A2:A14)"

NickHK

"Ajaynagpur" wrote in message
...
how to create farmula in excle programming




ViestaWu

how to create farmula in excle programming
 
If the cell or/and range is a variable, how to handle then?

Thanks at advance,
Viesta

"NickHK" wrote:

You mean:
Range("A1").Formula = "=SUM(A2:A14)"

NickHK

"Ajaynagpur" wrote in message
...
how to create farmula in excle programming





NickHK

how to create farmula in excle programming
 
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

"ViestaWu" wrote in message
...
If the cell or/and range is a variable, how to handle then?

Thanks at advance,
Viesta

"NickHK" wrote:

You mean:
Range("A1").Formula = "=SUM(A2:A14)"

NickHK

"Ajaynagpur" wrote in message
...
how to create farmula in excle programming







Tom Ogilvy

how to create farmula in excle programming
 
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.

--
regards,
Tom Ogilvy


"ViestaWu" wrote:

If the cell or/and range is a variable, how to handle then?

Thanks at advance,
Viesta

"NickHK" wrote:

You mean:
Range("A1").Formula = "=SUM(A2:A14)"

NickHK

"Ajaynagpur" wrote in message
...
how to create farmula in excle programming






All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com