Dear MrExcel community,
I am VBA beginner user and I am struggling with the following problem.
Basically, I need to copy all rows (variable number of rows, hence I am using the LastRow function) from Sheet2 and insert them below a user-selected cell (via InputBox) in Sheet1.
I wrote the following but it basically just adds and empty row.
However, if the destination range is fixed, the same macro would work
Sub Macro1()
Dim LastRow As Long
LastRow = Sheets("Sheet2").Cells(Sheets("Sheet2").Rows.Count, "A").End(xlUp).Row
Dim myReply As Range
Sheets("Sheet2").Range("A2:A" & LastRow).EntireRow.Copy
Set myReply = Application.InputBox(prompt:="Please any Stage cell: resupply stages will be added ABOVE this cell", Type:=8)
myReply.EntireRow.Select
Selection.Insert Shift:=xlDown
End Sub
Any help would be greatly appreciated!
Best,
Silvano
I am VBA beginner user and I am struggling with the following problem.
Basically, I need to copy all rows (variable number of rows, hence I am using the LastRow function) from Sheet2 and insert them below a user-selected cell (via InputBox) in Sheet1.
I wrote the following but it basically just adds and empty row.
However, if the destination range is fixed, the same macro would work
Sub Macro1()
Dim LastRow As Long
LastRow = Sheets("Sheet2").Cells(Sheets("Sheet2").Rows.Count, "A").End(xlUp).Row
Dim myReply As Range
Sheets("Sheet2").Range("A2:A" & LastRow).EntireRow.Copy
Set myReply = Application.InputBox(prompt:="Please any Stage cell: resupply stages will be added ABOVE this cell", Type:=8)
myReply.EntireRow.Select
Selection.Insert Shift:=xlDown
End Sub
Any help would be greatly appreciated!
Best,
Silvano