+ Reply to Thread
Results 1 to 9 of 9

VBA Sumifs with Multiple Worksheets

  1. #1
    Registered User
    Join Date
    11-30-2024
    Location
    Huntington Beach, CA
    MS-Off Ver
    365
    Posts
    3

    VBA Sumifs with Multiple Worksheets

    Hello everyone,

    I have so much respect for all the coders in this forum, for it is such a skill that I wish to master one day. I am in my 80s but find it fascinating.

    I am trying to use a sumifs using data from another workbook.

    All of my code works except when getting to the below line:


    Please Login or Register  to view this content.
    I have attached my workbooks and code for your reference. I have kept the workbooks as short as possible as per this forum guideline.
    Any help or guidance is so appreciated. Thank you.


    Please Login or Register  to view this content.
    APARTMENT_DATABASE.xlsmAPARTMENT_WEEKLY.xlsm
    Last edited by alansidman; 12-01-2024 at 12:07 AM.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: VBA Sumifs with Multiple Worksheets

    Hi and welcome

    You've not specified what your expected results are, so I'm guessing here based on the code you've provided.

    Give the below a try and see if it does what you need.
    Please Login or Register  to view this content.
    BSB
    Last edited by BadlySpelledBuoy; 11-30-2024 at 03:28 PM.

  3. #3
    Registered User
    Join Date
    11-30-2024
    Location
    Huntington Beach, CA
    MS-Off Ver
    365
    Posts
    3

    Re: VBA Sumifs with Multiple Worksheets

    Quote Originally Posted by BadlySpelledBuoy View Post
    Hi and welcome

    You've not specified what your expected results are, so I'm guessing here based on the code you've provided.

    Give the below a try and see if it does what you need.
    Please Login or Register  to view this content.
    BSB
    Dear BSB,
    First off, thank you so much for helping me. It is most kind of you and I am so appreciative.
    I apologize for the lack of explanations. I have attached an image of what I wish to do. In short, I was hoping to be able to code the below Sumifs into VBA and be able to paste this into Range (I2:I4).

    For your reference, the formula in regular Excel is:
    =SUMIFS([APARTMENT_DATABASE.xlsm]Sheet1!$E$2:$E$30,[APARTMENT_DATABASE.xlsm]Sheet1!$B$2:$B$30,A2,[APARTMENT_DATABASE.xlsm]Sheet1!$E$2:$E$30,">0")

    Attachment 884083

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,255

    Re: VBA Sumifs with Multiple Worksheets

    To get things going.
    Put the file in the same directory as the Apartment_Database file and click button.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,669

    Re: VBA Sumifs with Multiple Worksheets

    Administrative Note:

    We would very much like to help you with your query, however your post does not comply with our guidelines

    Please take a moment to review how to add code tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.

    I have added the code tags for you today. Please take a few minutes to re-read our guidelines and rules that you agreed to when you joined and comply in the future.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,955

    Re: VBA Sumifs with Multiple Worksheets

    I was hoping to be able to code the below Sumifs into VBA and be able to paste this into Range (I2:I4).
    For your reference, the formula in regular Excel is:
    =SUMIFS([APARTMENT_DATABASE.xlsm]Sheet1!$E$2:$E$30,[APARTMENT_DATABASE.xlsm]Sheet1!$B$2:$B$30,A2,[APARTMENT_DATABASE.xlsm]Sheet1!$E$2:$E$30,">0")
    Code in Apartment_Weekly file...Both books open...
    Please Login or Register  to view this content.
    Last edited by Sintek; 12-01-2024 at 01:17 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,255

    Re: VBA Sumifs with Multiple Worksheets

    Played around with your file a bit.
    The numbering of weeks is now automated. Just change the year in A1 and all numbers auto adapt.
    Fixed the first 4 columns so when you scroll to the right only numbers slide. Maybe some ideas to take to the original file.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-30-2024
    Location
    Huntington Beach, CA
    MS-Off Ver
    365
    Posts
    3

    Re: VBA Sumifs with Multiple Worksheets

    Thank you everyone,
    I have learned a lot from this thread and I have also been practicing with SUMPRODUCT. I can't to learn more and to one day contribute to this forum for others.
    Have a wonderful weekend

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,255

    Re: VBA Sumifs with Multiple Worksheets

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon (Next to Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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] SUMIFS Across Multiple WorkSheets
    By keith6292 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-30-2019, 03:50 AM
  2. [SOLVED] Sumifs Across multiple worksheets
    By Jstns in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-21-2017, 11:58 AM
  3. [SOLVED] Sumifs on across multiple worksheets
    By alonsogtz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-08-2015, 06:19 PM
  4. SUMIFS across multiple worksheets
    By JNAllen1990 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-18-2015, 12:04 AM
  5. [SOLVED] sumproduct and sumifs using multiple criteria across worksheets
    By mick86 in forum Excel General
    Replies: 4
    Last Post: 08-29-2012, 02:51 PM
  6. Sumifs across multiple worksheets
    By JohnFex in forum Excel General
    Replies: 12
    Last Post: 02-21-2012, 03:51 PM

Tags for this Thread

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