My macro is writing my text on the wrong line. The code is below. What I want to happen is A) copy line 270 under the existing data (skipping a line), B) copy the data OR write "this is nice" line under the existing data, C) copy line 270 under the existing data. What's happening is I get A,C,B instead of A,B,C. I'd appreciate help understanding why.
'A)On the APR, copy and paste the Procedure and title
Sheets("Sheet1").Range("A270").EntireRow.Copy Destination:=Sheets("Report").Range("A65536").End(xlUp).Offset(2, 0)
'B)Copy and paste the data
Sheets("Workspace").Activate
If Application.WorksheetFunction.CountA(Columns("A:A")) = 0 Then
Sheets("Report").Range("A65536").End(xlUp).Offset(1, 0) = "This is nice. All your positions match."
Else
Range("A1:I" & Range("I" & Rows.Count).End(xlUp).Row).Copy Sheets("Report").Range("A65536").End(xlUp).Offset(1, 0)
End If
'C)Copy and paste the Solution
LastRow = Sheets("Report").Range("I" & Rows.Count).End(xlUp).Row
Sheets("Sheet1").Range("A271").EntireRow.Copy Destination:=Sheets("Report").Range("A" & LastRow).Offset(1, 0)
UPDATE: I figured it out. It's my "Lastrow". I write my text in A, then check I for the last row. That'll do it every time. Thanks anyway.
Bookmarks