+ Reply to Thread
Results 1 to 18 of 18

Conditional average function

  1. #1
    Registered User
    Join Date
    08-09-2005
    Posts
    1

    Question Conditional average function

    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!

  2. #2
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  3. #3
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  4. #4
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  5. #5
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  6. #6
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  7. #7
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  8. #8
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  9. #9
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  10. #10
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  11. #11
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  12. #12
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  13. #13
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  14. #14
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  15. #15
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  16. #16
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  17. #17
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




  18. #18
    Bob Phillips
    Guest

    Re: Conditional average function

    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.

    --
    HTH

    Bob Phillips

    "Andres" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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!
    >
    >
    > --
    > Andres
    > ------------------------------------------------------------------------
    > Andres's Profile:

    http://www.excelforum.com/member.php...o&userid=26096
    > View this thread: http://www.excelforum.com/showthread...hreadid=394273
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1