+ Reply to Thread
Results 1 to 5 of 5

Adding workbook to application.worksheetfuntion

  1. #1
    Forum Contributor
    Join Date
    06-28-2009
    Location
    newcastle, uk
    MS-Off Ver
    Excel 2010
    Posts
    187

    Adding workbook to application.worksheetfuntion

    Hi guys

    I have a code set up which works great and does exactly as I want it to, but now I am trying to expand it and I am struggling with the addition. The code is below. What I would like is an additional set of functions using another active workbook, as so far the code is only for the workbook it is located in.

    Please Login or Register  to view this content.

    I am assuming the addition of a workbook would go between application and worksheetfunction, but so far all of my attempts have failed.

    If anyone could help out with this I would be really grateful.

    Thanks
    Gemma
    Last edited by batjl9; 07-27-2011 at 05:35 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Adding workbook to application.worksheetfuntion

    You would be adding to the target address, I think. You're wanting to apply functions to do SUMIF and COUNTIF with data from another workbook, yes?

    Please Login or Register  to view this content.

    This presumes the other workbook is open. More code could be added to check if the other workbook is open or not and open it if needed.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    06-28-2009
    Location
    newcastle, uk
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: Adding workbook to application.worksheetfuntion

    Wow I wasn't expecting a reply so quickly, thank you. I will get to work on it in a few hours when the girls go to bed and I have some peace and quiet!

    Thanks again

    Gemma

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Adding workbook to application.worksheetfuntion

    Just to add, consider using the With End syntax to trim down your code. For example:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-28-2009
    Location
    newcastle, uk
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: Adding workbook to application.worksheetfuntion

    The code works perfectly, thank you. I have also amended my codes trimming them down as you suggested.

    Thanks again
    Gemma

+ 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