Can I use INDIRECT in the code (of a function)

M

Michelle

I'm writing a UD function and I want to utilise the INDIRECT function in the
calculation, but it isn't in the pick-list for 'WorksheetFunction.' does
this mean I can't use it?

Is there an alternative?

M
 
D

Dave Peterson

If I had:
B1:B10
in A1 of a worksheet, I could use:

=sum(indirect(a1))
to sum B1:B10

In code, I'd just use:

with activesheet
msgbox application.sum(.range(.range("A1").value))
end with

..range("A1").value will be B1:B10
and that means that
..range("B1:b10")
will be summed.
 
M

Michelle

Thanks, I asked a bit of a thick question there, I really should have worked
that out. But thanks for the answer anyway.

M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top