Averaging in VB

  • Thread starter Thread starter NEWBIE
  • Start date Start date
N

NEWBIE

i'm writing a VB macro for excel and have run into a
problem: i have stored the addresses of cells into a
variable. i now would like to take the average of these
addresses using the variable onto a different Sheet. the
reason is that the number of rows and columns are supposed
to be arbitrary. here is an example of what i'm talking about:

Sheets("sheet2").select
temp = Range("B2", Range("B2","B2").End(xlDown)).Address
Range("A1").Select
' this next line is the problem
ActiveCell.Formula = "=AVERAGE(temp)"

for some reason excel wont let me take the average of
addresses stored in vatiables. any ideas?
 

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

Back
Top