Conditional average function

  • Thread starter Thread starter Andres
  • Start date Start date
A

Andres

I have a VBA code to calculate a "conditional average" of the days used
to issued official documents, given a range, and ID of the entity and
the column I want to calculate.
When I use the function in the same sheet I have the information to be
calculated, it works well. However, when using it in a different sheet
(of the same workbook), an error message is displayed.
It seems there's a reference problem when working with ranges, but I
have not found how to solve it.
Does anybody know what should I change for this function to work
properly?
Thank you very much in advance!
 
The code is?

Could well be unqualified ranges, such as

Worksheets("Sheet1").Range(Cells(A,1),Cells(2,2))

The Range refers to Sheet1 as it is qualified, but the Cells refer to the
active sheet as they are not.
 

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