Refer to Column with a variable
On 8 May, 01:13, straightedge32
wrote:
I tried doing just what you said, copying the syntax appropriately, but I
just get an error message stating "Run time error 438: Object Doesn't Support
this property or method".
Sorry, my mistake, I typed that reply last night on a machine without
Excel installed and I got it wrong (twice)
Set myRange = wrksht.Range(wrksht.Cells(nCurrRow, 8),
wrksht.Cells(nCurrRow, 16))
wrksht.Cells(nCurrRow, 17).Value =
Application.WorksheetFunction.Average(myRange.Valu e)
Will work. "Object Doesn't Support this property or Method" was due to
me inventing a new method "WorkSheetFunctions" when it is
"WorkSheetFunction"
Also, the .Value applies to myRange, not to Average() so it was in the
wrong place.
Sorry for any confusion I might have caused.
|