+ Reply to Thread
Results 1 to 17 of 17

Adapt this clean code from read to read + sum:

  1. #1
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Arrow Adapt this clean code from read to read + sum:

    --- The code below reads the 8th column and brings to a new sheet a quick big array with all the columns that have this cell filled.

    What's needed is for every product stored in the 1st column... I need this code to sum the same 1st column names' 5th column values to have the current 'product availability'

    Please Login or Register  to view this content.

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

    Re: Adapt this clean code from read to read + sum:

    Best way to get an answer that makes sence and to avoid back and forth messaging post an example file that reflects the situation.

    Create Before and After sheet. Mock up data if there's a problem with sensitive info.
    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.

  3. #3
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Re: Adapt this clean code from read to read + sum:

    Uploaded them as pictures for you!

    Basically the output.. would be on the 2nd page.. with every product name and their total sum (either positive or negative if we sold items that we have not got in stock)
    Attached Images Attached Images

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Adapt this clean code from read to read + sum:

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Re: Adapt this clean code from read to read + sum:

    I did that as pictures above! The file xlsx was 5 mb even after I reduced it into a new workbook so I couldnt upload it, but it's the same as watching the pics right? the code above is what needs to be adapted but I need your help for that part..

  6. #6
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Re: Adapt this clean code from read to read + sum:

    are they good enough?

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Adapt this clean code from read to read + sum:

    Hi and welcome to the forum

    Pictures are of little value. Honestly, no one wants to re-type your data to try and solve your issue. Additionally, we would only be guessing at how your data was structured, ie. formulas, formatting, etc. Additionally, due to how some browsers behave, many of our members cannot see uploaded pictures/images. Please upload a workbook instead. It doesn't have to be the actual workbook, just the same layout so that your code works and demonstrates what you want it to do.

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

    Re: Adapt this clean code from read to read + sum:

    We don't need the entire file, just a few hundred rows will do.

  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,338

    Re: Adapt this clean code from read to read + sum:

    Just a wild guess. Adapt sheetnames and ranges appropriatly.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Re: Adapt this clean code from read to read + sum:

    First of all, thank you so much for your replies, I tried bakerman's code but it gave me the following error while selecting solely '.keys':
    5I9znTg.jpg
    So I've attached the excel example of the real code...

    What's needed: to get a report for every product on the list for it's current stock availability. One sheet includes all the products we've bought and sold on the same list, the next sheet is for the report
    Attached Files Attached Files

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

    Re: Adapt this clean code from read to read + sum:

    My bad.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 05-24-2018 at 07:52 PM. Reason: Typo

  12. #12
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Re: Adapt this clean code from read to read + sum:

    Wait... I fixed it and Im reviewing the results!
    Last edited by 1.jclozano; 05-24-2018 at 11:03 PM.

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

    Re: Adapt this clean code from read to read + sum:

    Is Sheet1 the correct sheetname ?
    Attached Files Attached Files
    Last edited by bakerman2; 05-24-2018 at 11:03 PM.

  14. #14
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Re: Adapt this clean code from read to read + sum:

    Yes but I was using the 2nd name of the sheets.. the base name

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

    Re: Adapt this clean code from read to read + sum:

    Then just change this
    Please Login or Register  to view this content.
    To this
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    09-25-2017
    Location
    London
    MS-Off Ver
    7
    Posts
    13

    Re: Adapt this clean code from read to read + sum:

    Is it possible if you can tell me how may I adapt this code to give me the same availability but for any product name that is on the list that I can choose?

    I' currently counting to check if it's summing correctly

    it looks really good it takes 1 second to finish or less!!!! Thank you so much bakerman da man!!!!!!

    Your code is too succinct/advanced for my knowledge
    Last edited by 1.jclozano; 05-24-2018 at 11:25 PM.

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

    Re: Adapt this clean code from read to read + sum:

    Select a product in combobox on sheet1.

    Result is displayed in MsgBox.
    Attached Files Attached Files

+ 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] Create Macro that asks for read only or read-write access
    By evanneedshelp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2018, 08:07 AM
  2. Replies: 1
    Last Post: 07-10-2016, 02:27 PM
  3. Open workbook in read only or read write for excel 2010 version
    By Agent1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-20-2014, 07:19 PM
  4. Cant adapt MSQuery Macro to read VBA Variables
    By TrevorFix in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-07-2014, 08:46 AM
  5. [SOLVED] Checking to see if a file has been opened in Read/Write or Read Only
    By brokenbiscuits in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2014, 09:16 AM
  6. VBA to read data and adapt to new template
    By cwyenberg in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-05-2013, 10:49 PM
  7. Read Only Dialog boxes - Opting for Read Only with VBA
    By Emm100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2005, 07:12 AM

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