VBA & Macro Problems

Paste Values into the Next Empty Row in Excel VBA

Ayan MasoodAyan Masood Nov 25, 2026 870 views

Question details

Paste selected values into column E starting at row 13 or below the existing data without exceeding the worksheet boundary.

Paste Values into the Next Empty Row in Excel VBA
Product
Microsoft Excel VBA
Device & OS
not provided
Scenario
A macro needs to append selected values to a worksheet, using E13 as the first destination row.
Observed behavior
Searching downward can reach the last worksheet row, causing an error when the macro offsets to a row beyond it.
Before you start

Open the workbook in a version of Excel that supports VBA, and save it as an Excel Macro-Enabled Workbook (.xlsm). Enable macros only if you trust the workbook, and identify the single-column range you want to copy.

Solution 1Recommended

Find the Last Used Row from the Bottom of Column E

Use this macro to append a single-column selection as values, starting no earlier than E13 and checking that the destination fits.

The macro searches upward from the bottom of column E. It appends below the last used cell rather than filling gaps between existing entries.

1
Open the VBA editor

In Excel, open the Developer tab and select Visual Basic, then choose Insert > Module.

2
Add the macro

Paste this code into the module: Sub Btn_Add() Dim ws As Worksheet Dim src As Range Dim lastRow As Long Dim nextRow As Long If TypeName(Selection) <> "Range" Then MsgBox "Select a single-column range first." Exit Sub End If Set src = Selection If src.Areas.Count <> 1 Or src.Columns.Count <> 1 Then MsgBox "Select one contiguous column of cells." Exit Sub End If Set ws = ActiveSheet lastRow = ws.Cells(ws.Rows.Count, "E").End(xlUp).Row If lastRow < 13 Then nextRow = 13 Else nextRow = lastRow + 1 End If If nextRow > ws.Rows.Count Or src.Rows.Count > ws.Rows.Count - nextRow + 1 Then MsgBox "There is not enough space in column E." Exit Sub End If src.Copy ws.Cells(nextRow, "E").PasteSpecial Paste:=xlPasteValues Application.CutCopyMode = False End Sub

3
Select and run

Return to the worksheet, select one contiguous column of cells, and run Btn_Add from Developer > Macros. The macro pastes values on the active worksheet.

Find the Last Used Row from the Bottom of Column E
Destination behavior: If column E has data below E13, the macro appends below that data even when E13 is empty. If the selection will not fit, it displays a message instead of pasting.
Free Microsoft Office alternative

Work with Excel Spreadsheets in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Excel format compatibility for an easier transition. Use WPS Spreadsheets to review and edit destination rows; it does not fix Excel’s VBA error, and macro support varies by version.

Review and edit column E in WPS SpreadsheetsOpen and edit compatible Microsoft Excel .xlsx filesUse a familiar spreadsheet interface for easier migrationWork with a free, lightweight Office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does End(xlDown) cause an error at the bottom of the worksheet?

End(xlDown) can reach the final worksheet row. Calling Offset(1) from that row points outside the worksheet, so Excel raises an error.

What happens if E13 is blank but there is data farther down column E?

The macro searches upward from the bottom of column E and pastes below the last used cell. It does not fill E13 in that case.

Does this macro paste formulas or formatting?

No. PasteSpecial with xlPasteValues pastes the selected cells’ values, not their formulas or formatting.

What if the last used cell is already in the final row?

The macro checks the available space before copying. If there is no room for the full selection, it shows a message and exits without pasting.

Can I run the Excel macro in WPS Office?

VBA support varies by WPS Office version and installation. Check the macro capabilities of your version before relying on the Excel procedure or transferring a macro-enabled workbook.