The 1st block of code below is meant to start in row 6, and fill every blank row in Column A with data from the row above if the same row in Column B has data. The same is true for the 2nd block of code except the Columns are D and B. If I try to run both codes in one macro and row 6 is the only row with data I receive an error message that says ‘Error: application defined or object defined error’ and this line of code
gets highlighted in yellow. Do you know why that is happening and how I can fix it so I can run both codes in the same macro with one row of data and not get an error message?
<o></o>
Code:
M.Value = M.Offset(-1).Value
Code:
Dim I As Range<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Dim J As Range<o:p></o:p>
Dim K As Long<o:p></o:p>
On Error GoTo L<o:p></o:p>
With Worksheets("Sheet1")<o:p></o:p>
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row<o:p></o:p>
Set J = .Range("A6:A" & LastRow).SpecialCells(xlCellTypeBlanks)<o:p></o:p>
For Each I In J<o:p></o:p>
I.Value = I.Offset(-1).Value<o:p></o:p>
Next<o:p></o:p>
End With<o:p></o:p>
L:<o:p></o:p>
<o:p> </o:p>
Dim M As Range<o:p></o:p>
Dim N As Range<o:p></o:p>
Dim O As Long<o:p></o:p>
On Error GoTo P<o:p></o:p>
With Worksheets("Sheet1")<o:p></o:p>
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row<o:p></o:p>
Set N = .Range("D6:D" & LastRow).SpecialCells(xlCellTypeBlanks)<o:p></o:p>
For Each M In N<o:p></o:p>
M.Value = M.Offset(-1).Value<o:p></o:p>
Next<o:p></o:p>
End With<o:p></o:p>
P: