+ Reply to Thread
Results 1 to 48 of 48

Run time error 7. Out of memory Rajesh

  1. #1
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Run time error 7. Out of memory Rajesh

    Hello experts
    I am trying to extract data from master sheet (SRS data) sheet and enter it into 3 new created sheets by the code. But I am stuck in the first sheet itself. I am facing a run time error 7 out of memory. Please help me to correct this code or help me with a new code for at least 1 sheet so that I can get the data for the remaining 2 sheets accordingly.
    Thank you in advance.
    Attached Files Attached Files
    Last edited by RAJESH SHAH; 01-23-2023 at 02:29 PM. Reason: #Solved by beyond excel

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,717

    Re: Run time error 7. Out of memory Rajesh

    Administrative Note:

    YOU HAVE HAD TO BE WARNED ABOUT THIS TOO MANY TIMES!!!

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    (Note: this requirement is not optional. No help to be offered until you provide a link or, for members with fewer than 10 posts, a comment telling us where else you have posted this query.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Sorry. Forgot to do so. This is the only link I have posted to.
    https://forum.ozgrid.com/forum/index...76#post1259576
    Last edited by RAJESH SHAH; 01-23-2023 at 06:03 AM.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    Apart from anything else check out you formula:

    Step2 G (Qty)

    =SUMIFS(SRSData!$K:$K,SRSData!$B:$B,$A2,SRSData!$R:$R,Step2!$F2,SRSData!$M:$M,Step2!C2)
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    John Topley. I am not getting it. There are no R R and M M range in the formula. If you check the Step1ER(Expected Result sheet) it is the same formula. The range is right and I think there must be some error in converting it into a code. Will check again.

  6. #6
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    I assume it is because of the values in columns E and F in step2 Sheet. The format is changed when posted from the SRSData sheet. The quantity column is connected to column F and hence the errror. Not sure. Back to the drawing board I guess.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    ... That is because your formula was wrong!!!!: it was not matching the correct ranges.

    Attached now has correct formula.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    John Topley. You entered the formulas of HSN sheet in Step2 sheet. Looks like you corrected the CHSN code. Will check and if it is correct than I think I can come up with the other 2 sheets. Will revert book as soon as I finish checking it.
    Last edited by RAJESH SHAH; 01-23-2023 at 09:02 AM.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    The code I checked was in macro "Astep2".

  10. #10
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    No/ You check the raw code of HSN which is not yet edited. I dropped the idea of using .Offset as it was not working and was trying for Formula array in the AStep1code.
    Last edited by RAJESH SHAH; 01-23-2023 at 08:59 AM.

  11. #11
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    The HSN code will work only after Step2 and B2B SRS are created. So, I was trying to create Step2 sheet and get the result.

  12. #12
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    These are the formulas in Step2 which need to be corrected.
    Please Login or Register  to view this content.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    Those are the formulas in "Astep2" which I corrected!

  14. #14
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Oh Yeah. Sorry. I am fully confused. The formulas are posted correctly in the second row. Can you tell me why they are not filled down.? I have this code to fill them down.
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    My bad. Even the remove duplicates is displaying the wrong answer. There are only 268 rows in Step2 sheet where as in the expected sheet it is 272 rows. Please let me check it out once again and try to rectify it. I want to keep this post open till it is completely solved. Will be back once I figure out what is the mistake. Thanks for the help with the formulas John Topley.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    Please Login or Register  to view this content.

    The highlighted need to be moved to before ..

    Please Login or Register  to view this content.
    and you will need to add a "row counter" as you go through the loop for example

    Please Login or Register  to view this content.
    becomes

    Please Login or Register  to view this content.
    nextrow is incremented each time you get a new key from the Scripting Dictionary

  17. #17
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Like this right ??
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Quote Originally Posted by JohnTopley View Post
    Please Login or Register  to view this content.

    The highlighted need to be moved to before ..

    Please Login or Register  to view this content.
    and you will need to add a "row counter" as you go through the loop for example

    Please Login or Register  to view this content.
    becomes

    Please Login or Register  to view this content.
    nextrow is incremented each time you get a new key from the Scripting Dictionary
    I didn't understand this part.
    I have changed the nextrow to LastRowStep2 as the variable is there and defined.
    Please Login or Register  to view this content.

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    Yes ... and same for your "Formulasarray" etc

  20. #20
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Which is the highlighter which needs to be moved and to where. ?

  21. #21
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Please confirm so that I can edit the rest of the code. Is it like this
    Please Login or Register  to view this content.

  22. #22
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Does this line too need to be edited ? Please correct this line.
    Please Login or Register  to view this content.

  23. #23
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    John Topley. It is dinner time. Please leave a reply for post #21 and #22. Will continue as soon I finish my dinner.

  24. #24
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    This is the one needing changing

    Sheets("Step2").Range("G2:K2").Formula = FormulasArray

    to

    Sheets("Step2").Range("G" & lastrowStep2 &":K" & lastrowStep2).Formula = FormulasArray

    NOT the one(s) in post #21

    and No : post #22 is OK

    I seriously suggest you practice your VBA on something much simpler rather [than on your production system]!

  25. #25
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Done. But still facing an error and the data is posted till the last row in the sheet in column F. Please check the workbook if I have missed anything or done something incorrect. The posting also starts from the 20th row.
    Attached Files Attached Files

  26. #26
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    One more thing please. The code to remove the duplicates is not showing the right number of rows in the result (Step2). If you manually select the columns 2,3,6,13,15,18 from SRSData, it will show 272 rows of data but with the code it is showing less.

  27. #27
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    After some corrections. the code ran without any error. But the columns in A to F are all posted from the wrong columns in Step1 sheet. Using F8, I checked and the error looks like in this line.
    Please Login or Register  to view this content.

  28. #28
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    I am sharing the updated file.
    Attached Files Attached Files

  29. #29
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    Please Login or Register  to view this content.
    My mistake in changing loop But corrected ALL formula so now "looks" OK.
    Attached Files Attached Files

  30. #30
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    John Topley. The columns in step1 sheet from A to F are taking the data from the wrong columns.

  31. #31
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    Check the code yourself and make sure ALL the right sheets are being referenced correctly as the code "jumps" to/from numerous sheets: I am not here to teach you VBA.

  32. #32
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Ok. Thanks John Topley for all the help and your time.

  33. #33
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    I have not changed anything relating to columns A-F: I assume you mean this ??


    Please Login or Register  to view this content.

  34. #34
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    I closed the file and reopened and tested again. It is working and I got all the headings and formulas correct. Only thing left is to check the remove duplicates code. Manually it will show 272 rows and by code it is showing 268 rows only.

  35. #35
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    So which rows are different: check the data as "Scripting Dictionary" is very unlikely to make a "mistake".

  36. #36
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    The very first row in SRS Data sheet for instance is not in Step2.

  37. #37
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    The earlier project which I did for step1 the same error is there. I didn't notice it till now.

  38. #38
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Run time error 7. Out of memory Rajesh

    Hello.
    The template I attached basically does the following on each sheet:

    a) Clear the entire sheet.
    b) Filter and copy the unique values of each sheet.
    c) Copy and paste down the formulas that are in row 2 of each sheet.
    d) Sets all rows except row 2 to values.

    And that's why the VBA code is so short: because it's based on the formulas in the 2 rows of each sheet.
    Attached Files Attached Files
    You are always very welcome if you add reputation by clicking the * (bottom left) of each message that has helped you.

  39. #39
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Wow! We were almost done with the issues with step2 sheet. You solved all the 3 sheets in one go. Simply brilliant.
    Thank you very much beyond excel.

  40. #40
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Run time error 7. Out of memory Rajesh

    This

    For i = 2 To UBound(Data)

    NOT this

    For i = 6 To UBound(Data)

  41. #41
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    John Topley, If you come across for the reason for the issue in the remove duplicates code, please let me know what could be the reason. So that I can correct the previous code of step1. I really appreciate the time you spent to help me understand the code.
    Thank you guys.

  42. #42
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Thanks man. Now the result is perfect. I will correct the previous code too.

  43. #43
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    This is the code of the Step1 and I replaced 4 with 2 and it is showing an error at this line
    Please Login or Register  to view this content.
    If you correct this, then the step1 will also be completed.
    Please Login or Register  to view this content.

  44. #44
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Please Login or Register  to view this content.
    This was your previous code. I had to add one more criteria to remove the duplicates and I added Temp4 in the code. This has the same problem in the count of rows.

  45. #45
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Run time error 7. Out of memory Rajesh

    Quote Originally Posted by RAJESH SHAH View Post
    Wow! We were almost done with the issues with step2 sheet. You solved all the 3 sheets in one go. Simply brilliant.
    Thank you very much beyond excel.
    a) Thanks for the comment. You just need to click on the * below and to the left of post #38

    b) I am attaching the Sub Macro9() with explanatory comments as you requested:


    Please Login or Register  to view this content.

  46. #46
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Thanks beyond excel. I am very grateful to you for the comments.

  47. #47
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Run time error 7. Out of memory Rajesh

    Quote Originally Posted by RAJESH SHAH View Post
    Thanks beyond excel. I am very grateful to you for the comments.
    It was a great pleasure to help you and I hope you have the desire and time to gradually learn about these VBA topics.

  48. #48
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Run time error 7. Out of memory Rajesh

    Quote Originally Posted by beyond Excel View Post
    It was a great pleasure to help you and I hope you have the desire and time to gradually learn about these VBA topics.
    Pleasure was all mine. I learn from the comments only. As you have provided the code with the comments it would help me to learn, edit, modify whenever and wherever necessary in future.

+ 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] Run-Time error '7' Out of Memory
    By smciesl2 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-24-2014, 01:50 PM
  2. [SOLVED] Run-time error '7': Out of memory
    By jitte in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-10-2013, 06:14 AM
  3. Run Time error 7 - out of memory
    By sfw1973 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2013, 11:55 AM
  4. [SOLVED] Run-time error 7: out of memory
    By gandrea in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2012, 08:16 PM
  5. [SOLVED] Run-time error 7 out of memory vba
    By Jovica in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2012, 09:08 AM
  6. Run-time error 7 out of memory vba
    By Macro1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2010, 09:42 AM
  7. Run-time error '7': Out of memory
    By rpollard001 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2006, 02:15 AM

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