Macro Error: Unable to get Var property

P

Peter Bernadyne

My macro appears to have trouble calculating variance (using th
worksheet function) for a range of cells I have.

The code I have is:

Lead_Y = ((WorksheetFunction.count("A:A") - 1)
WorksheetFunction.Var("A:A")) / WorksheetFunction.Var(Original_Y)

Where Original_Y is defined as:

Set Original_Y = Worksheets("Sheet1").Range("A3:A300")

My error is:

Run-time error '1004':

Unable to get the Var property of the WorksheetFunction class

Any ideas why I might be getting this message would be tremendousl
appreciated.

Thanks,

-Pet
 
F

Frank Kabel

Hi
try
Lead_Y = ((WorksheetFunction.count("A:A") - 1) *
WorksheetFunction.Var(Range("A:A"))) /
WorksheetFunction.Var(Original_Y)
 
P

Peter Bernadyne

Thank you very much for your help.

This worked perfectly.

Best Regards,

-Pet
 
Top