G
Guest
I'm trying to calculate an average using VBA from a recorded macro
in Excel, so basically I'm using the AVERAGE built-in function from excel.
First i'm counting the nr of records in my recordset and then that result
should be stored as a variable in the range for my average.
The variable row contains the recordcount and is an integer.
With xlObject
.Range("I2:I2").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-2]:R[& row & ]C[-2])"
.Range("I3").Select
End With
When running the procedure I get an error message saying object is required
on the line that starts with ActiveCell.FormulaR1C1...
Does anyone see what I'm doing wrong here, or I'm I missing some piece
of code here? Many thanks.
in Excel, so basically I'm using the AVERAGE built-in function from excel.
First i'm counting the nr of records in my recordset and then that result
should be stored as a variable in the range for my average.
The variable row contains the recordcount and is an integer.
With xlObject
.Range("I2:I2").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-2]:R[& row & ]C[-2])"
.Range("I3").Select
End With
When running the procedure I get an error message saying object is required
on the line that starts with ActiveCell.FormulaR1C1...
Does anyone see what I'm doing wrong here, or I'm I missing some piece
of code here? Many thanks.