PDA

View Full Version : Run Time Error 7



Abhishek Gha
07-24-2012, 01:01 AM
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.:banghead:

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

Bob Phillips
07-24-2012, 01:13 AM
Post a sample workbook that bombs.

Abhishek Gha
07-25-2012, 12:49 AM
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

Bob Phillips
07-25-2012, 01:04 AM
Not a lot we can do if the file does not error.