我在工作表的一系列单元格中有一个公式,可以计算出数值。如何从传递给函数的范围中获取VBA中的数值?
假设工作表中的第一列的前10行包含rand()函数,并将其作为参数传递给我的函数...
public Function X(data as Range) as double
for c in data.Cells
c.Value 'This is always Empty
c.Value2 'This is always Empty
c.Formula 'This contains RAND()
next
end Function
我从单元格中调用该函数...
=X(a1:a10)
我该如何获取单元格的值,例如0.62933645?
Excel 2003,VB6