Results 1 to 3 of 3

Thread: Copy & insert the currently selected row of data multiple times

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Administrator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,306
    Location
    Hi Scawtt,

    Welcome to the forum.

    Out of interest, which version of Excel do you use: 2016, 2021, 365?

    If you are using Excel 365 for example then the below will do it:
    Sub Test()
        Dim r As Long, str As String, rpt As Long, s As Variant  
        r = ActiveCell.Row
        str = Cells(r, 1)
        rpt = Cells(r, 2)  
        Rows(r + 1 & ":" & r + (rpt - 1)).Insert
        With Application
             s = .Sequence(rpt, , 1, 0)
             Cells(r, 1).Resize(rpt) = .Rept(str, s)
             Cells(r, 2).Resize(rpt) = s
        End With
    End Sub
    Attached Files Attached Files
    Last edited by Aussiebear; 05-04-2025 at 12:13 AM.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2408, Build 17928.20080

Tags for this Thread

Posting Permissions

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