Consulting

Results 1 to 4 of 4

Thread: Run Time Error 7

  1. #1

    Post Run Time Error 7

    Please help ,

    Below code is for Data Merging from blank cells (Rows).One slight issue I am facing using this code, though it works fine on many of the reports (sheets), however on one of the report (sheet) it shows "Run Time error '7'; Out of memory". Below highlighted is the code which gets colored in yellow (error) for Debugging.

    [VBA]Option Explicit

    Sub consolidate_rows()
    Dim i As Long, j As Long, lrow As Long, lcol As Long

    With Worksheets("Sample")
    lrow = .Range("A" & .Rows.Count).End(xlUp).Row
    lcol = .Range("IV1").End(xlToLeft).Column
    For i = lrow To 2 Step -1
    If .Range("A" & i).Value = "" Then
    For j = 4 To lcol
    .Cells(i - 1, j).Value = .Cells(i - 1, j).Value & " " & .Cells(i, j).Value
    Next j
    .Rows(i).Delete
    lrow = lrow - 1
    End If
    Next i
    End With
    End Sub[/VBA]
    Last edited by Bob Phillips; 07-24-2012 at 01:12 AM. Reason: Added VBA tags

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Post a sample workbook that bombs.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    Post

    Hi,

    Unfortunately, I cannot upload the real file but I have attached one of the sample file which will give you the idea of this macros execution. I do not encounter any error ""Run Time error '7'; Out of memory". on this file but one of the reports which is of 483 kb faces this error and the funny part is I have another file of 674 kb (largest) and I did not face this error on it.

    Regards,

    Abhishek Ghai
    Attached Files Attached Files

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Not a lot we can do if the file does not error.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •