Results 1 to 8 of 8

Insert (paste) multiple rows below a user-selected cell

Threaded View

  1. #1
    Registered User
    Join Date
    02-18-2021
    Location
    Basel
    MS-Off Ver
    365
    Posts
    12

    Insert (paste) multiple rows below a user-selected cell

    Dear Excel Forum 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
    Attached Files Attached Files
    Last edited by AliGW; 10-10-2023 at 03:44 AM. Reason: Code tags added - please review the forum guidelines.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy multiple rows, prompt user after which row to insert them
    By Tsinos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-06-2021, 08:33 AM
  2. [SOLVED] Insert multiple rows and copy paste text from different sheet based on cell Value
    By amitmodi_mrt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-12-2021, 02:45 PM
  3. Replies: 1
    Last Post: 01-12-2021, 02:22 AM
  4. Insert rows for multiple selected rows
    By JN12345 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-25-2018, 04:18 PM
  5. [SOLVED] Paste formula from a row into multiple selected rows?
    By max3732 in forum Excel General
    Replies: 2
    Last Post: 05-26-2017, 11:25 AM
  6. [SOLVED] Insert User Selected Number of Blank Rows
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2012, 12:33 PM
  7. Insert rows based on user input from cell value in other sheet
    By MrPisky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-31-2011, 09:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1