+ Reply to Thread
Results 1 to 5 of 5

SumIf WorksheetFunction referencing another workbook

  1. #1
    Registered User
    Join Date
    10-05-2013
    Location
    indonesia
    MS-Off Ver
    Excel 2013
    Posts
    6

    SumIf WorksheetFunction referencing another workbook

    Dear all,

    I'm trying to use the SumIf worksheetfunction in VBA, looking in another workbook, but I apparently use the wrong reference. It works without any problem in Excel. I receive the following pop up message : "method range of object worksheet failed"

    Here is my code :

    Please Login or Register  to view this content.

    I understand that to be proper, I should use workbooks(File).worksheets("Budget 2013").range("Q5:Q52"), but I'm afraid that my code will be too long, because I'd like to use many conditions (with SumIfs)...
    I already tried many attempts without any success, would you have any idea about my mistake?

    Many thanks in advance for your lights.

    Best regards,

    Eric

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: SumIf WorksheetFunction referencing another workbook

    Sumif won’t work with closed workbooks.

    Incase if the source workbook is kept open then no need of root path in your code…


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    10-05-2013
    Location
    indonesia
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: SumIf WorksheetFunction referencing another workbook

    Thanks Sixthsense, but do you know why I have this error message? Because I will probably use SumProduct function to work with closed book and I will probably face the same problem, don't you thinks so?

    Eric

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: SumIf WorksheetFunction referencing another workbook

    You may not refer to a Range object in VBA in a workbook that is closed.

  5. #5
    Registered User
    Join Date
    10-05-2013
    Location
    indonesia
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: SumIf WorksheetFunction referencing another workbook

    Quote Originally Posted by Izandol View Post
    You may not refer to a Range object in VBA in a workbook that is closed.
    Noted Izandol, thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Error Using WorksheetFunction.SumIf
    By unvme1212 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-18-2013, 01:52 PM
  2. [SOLVED] SUMIF function don't return same result with Evaluate and Application.WorksheetFunction
    By zbor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-31-2012, 12:48 PM
  3. Replies: 0
    Last Post: 06-01-2012, 03:18 AM
  4. [SOLVED] SUMIF and 3D Referencing
    By youradhere4222 in forum Excel General
    Replies: 2
    Last Post: 03-28-2012, 07:09 PM
  5. vba and conditional totalling ... WorksheetFunction SumIf ?
    By SA3214 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-29-2005, 03:05 PM

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