+ Reply to Thread
Results 1 to 7 of 7

Run-Time error '7' Out of Memory

  1. #1
    Registered User
    Join Date
    03-24-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Run-Time error '7' Out of Memory

    Hi!

    I am very VERY new to VBA macros. After spending a few days trying to put together logic by looking at different websites and codes, I finally thought I had something that would work.... however, I went to run the code and I received a run time error I cannot figure this one out... please help! here is my code:


    Sub CDW()

    Dim wb As Worksheet: Set wb = ActiveWorkbook.Sheets("Routing Guide Overview")
    Dim wb2 As Worksheet: Set wb2 = ActiveWorkbook.Sheets("PRINTABLE Routing Guide")
    Dim ToFind As String
    Dim i, x As Long
    Dim Ary1 As Range
    Dim Ary2 As Range
    Dim size As String


    Application.ScreenUpdating = False

    i = 2
    x = 12
    size = "20FT"
    ToFind = "CDW"


    Do
    i = i + 1
    For i = 2 To 1000:
    If wb.Cells(i, 2) = ToFind And wb.Cells(i, 3) = size Then
    wb.Activate
    Set Ary1 = Range("Fi:Ii")
    wb2.Activate
    Set Ary2 = Range("Ax:Dx")
    Ary2.Value = Ary1.Value
    x = x + 1
    End If
    Next i

    Loop Until Cells(i, 2).Value = ""

    End Sub

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Run-Time error '7' Out of Memory

    Too much loop. What are you trying to accomplish, there is probably a more efficient way.

  3. #3
    Registered User
    Join Date
    03-24-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Run-Time error '7' Out of Memory

    Ok

    I want to loop through column B in the "Routing Guide Overview" to look for the term CDW (there are multiple). For each time it finds CDW, I want it to look at column C to ensure it lists "20FT". If both of those values are true, then I would like to copy the corresponding cells in columns F through I on the "Routing Guide Overview" on to columns A through D on the sheet titled "PRINTABLE Routing Guide"

    For reference there are currently 500 rows on "Routing Guide Overview" it would need to loop through.

    Thank you for the help!!

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Run-Time error '7' Out of Memory

    Good Explanation. Try this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-24-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Run-Time error '7' Out of Memory

    OMG Fantastic!!!!

    Now if I can be picky.. is there a way to only paste special values? Also I forgot to add I need the paste to start on A12 not A1 of "PRINTABLE Routing Guide".

    you are awesome!! you saved me a lot of headache!!

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Run-Time error '7' Out of Memory

    Updated:

    Please Login or Register  to view this content.
    *If the supplied code works for you I would be more than happy to receive rep points (bottom left)

  7. #7
    Registered User
    Join Date
    03-24-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Run-Time error '7' Out of Memory

    This is fantastic!! Thank you!

    And yes I would be more than happy to give you as many rep points as possible. thank you for the help!

+ 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 jitte in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-10-2013, 06:14 AM
  2. 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
  3. [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
  4. [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
  5. 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

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