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