G Guest Jul 13, 2006 #3 If the cell or/and range is a variable, how to handle then? Thanks at advance, Viesta
N NickHK Jul 13, 2006 #4 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
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
G Guest Jul 13, 2006 #5 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.
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.