Paste Down Until Last Row

iSoleil

New Member
Joined
Oct 14, 2017
Messages
17
Hi,

I'm a newbie to excel and was wondering if someone could help me with this.

I have a sheet "Template" where I want to copy range C2:C6 and paste transposed to another sheet "Archive".
On "Archive", I have a table with already prefilled data on columns A:G from this code:

VBA Code:
Sub attendees()

    Range("B13").Select 'from sheet "Template"
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy

    With Sheets("Archive").Range("A" & Rows.Count).End(xlUp).Offset(1)
        .PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=False
    End With
    
End Sub

What I want to do is populate the rows from H:L with same data from C2:C6 paste transposed values and number formats only.
I managed to work out the paste transposed part but cannot seem to figure out the paste down until last row to match up on the A:G data for the life of me.

VBA Code:
Sub topics()

    Range("C2:C6").Select  'from sheet "Template"
    Selection.Copy

    With Sheets("Archive").Range("H" & Rows.Count).End(xlUp).Offset(1)
        .PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=True
    End With
    
End Sub

This is ideally what I want to do, where Date Discussed - Facilitator will just be the same entry for all items copied under the same code/batch:

User EmailJoin TimeLeave TimeDuration (Minutes)GuestNameL1Date DiscussedBatchAudienceTopicFacilitator/s
abc@sgadfa.com
10/20/2022 14:51​
10/20/2022 15:34​
43​
Noasfdjgk;kadglsv10/20/20223asfdfaasfdfaasfdfa
fjk@ladjgr.com
10/20/2022 14:59​
10/20/2022 15:34​
35​
Nojdgslkhglsdgl10/20/20223asfdfaasfdfaasfdfa
htoak@akhdg.com
10/20/2022 15:00​
10/20/2022 15:34​
34​
Noadgijg;ljgst10/20/20223asfdfaasfdfaasfdfa
adgjldngs@isutslg.com
10/20/2022 14:51​
10/20/2022 15:34​
43​
Nofdjhkhdgsfv10/20/20223asfdfaasfdfaasfdfa

Any inputs will be highly appreciated. Thank you!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try this:
VBA Code:
Public Sub Paste_Rows()

    Worksheets("Template").Range("C2:C6").Copy

    With Worksheets("Archive")
        .Range("H2:L" & .Range("A" & .Rows.Count).End(xlUp).Row).PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=True
    End With
    Application.CutCopyMode = False
    
End Sub
 
Upvote 0
Leveraging off John's code, I believe you are after both the start and end of the range.
(You can do it without variables but it will get very long)

VBA Code:
Public Sub topics()

    Dim startRow As Long, endRow As Long

    Worksheets("Template").Range("C2:C6").Copy

    With Worksheets("Archive")
        startRow = .Range("H" & .Rows.Count).End(xlUp).Row + 1
        endRow = .Range("A" & .Rows.Count).End(xlUp).Row
        .Range("H" & startRow & ":L" & endRow).PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=True
        'OR
        '.Range(.Cells(startRow, "H"), .Cells(endRow, "L")).PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=True
    End With
    Application.CutCopyMode = False
    
End Sub
 
Upvote 0
Solution
Leveraging off John's code, I believe you are after both the start and end of the range.
(You can do it without variables but it will get very long)

VBA Code:
Public Sub topics()

    Dim startRow As Long, endRow As Long

    Worksheets("Template").Range("C2:C6").Copy

    With Worksheets("Archive")
        startRow = .Range("H" & .Rows.Count).End(xlUp).Row + 1
        endRow = .Range("A" & .Rows.Count).End(xlUp).Row
        .Range("H" & startRow & ":L" & endRow).PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=True
        'OR
        '.Range(.Cells(startRow, "H"), .Cells(endRow, "L")).PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=True
    End With
    Application.CutCopyMode = False
   
End Sub
Thanks, Alex! This was what I needed. May your day be as bright as mine! :D
 
Upvote 0
Try this:
VBA Code:
Public Sub Paste_Rows()

    Worksheets("Template").Range("C2:C6").Copy

    With Worksheets("Archive")
        .Range("H2:L" & .Range("A" & .Rows.Count).End(xlUp).Row).PasteSpecial xlPasteValuesAndNumberFormats, Transpose:=True
    End With
    Application.CutCopyMode = False
   
End Sub
Thanks for the immediate reply, John!
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top