Copy and Paste into next available row.

cguy3000

New Member
Joined
May 30, 2019
Messages
15
Alright folks,

I am having an issue with copying and pasting into the next blank cell onto a new sheet.

I currently have a macro in excel that adds a new row at the bottom of a data set and then sets the current date into the cell A1 of that new row and the rest of the cells are blank. What I am trying to do next is take a row of data from a different sheet and past it into the new row i just inserted but starting at cell B1 and then continuing down the row to paste the rest of the values.

This is the current code I have and it wont work. Can anybody either revise this one to work or give me a new one entirely so that it does copy and paste the way I want it to.


Sheets("Weekly Placements").Activate


Range("A100").End(xlDown).Select


r = Selection.Row
Cells(r + 1, 1).EntireRow.Insert
Cells(r, 1).Copy Destination:=Cells(r + 1, 1)

Range("A100").End(xlDown).Select


Dim ts As Date
With Selection
.Value = Now
.NumberFormat = "m/d/yyyy"
'--------------------------------------------------------------------------------
Dim LastRow As Long
LastRow = Sheets("Source Data2").UsedRange.Rows.Count
Sheets("Source Data2").Range("C4:N4").Copy
Sheets("Weekly Placements").Range ("B" & LastRow + 1)

Sheets("Weekly Placements").Select


End With
End Sub



Now everything below the ------- line is the part of the code in question that doesnt work correctly. Everything above the -------- currently works and adds a new row of data at the first empty cell of A column and adds the current date.

The references are all right as well so if you guys know how to make that copy and paste work that would be so helpful!!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
maybe change
Code:
Sheets("Source Data2").Range("C4:N4").Copy
Sheets("Weekly Placements").Range ("B" & LastRow + 1)
to
Code:
Sheets("Source Data2").Range("C4:N4").Copy
Sheets("Weekly Placements").Range ("B" & LastRow + 1).Paste
 
Upvote 0
Try this

Adjust the sheet for the LastRow
Code:
    Dim LastRow As Long
    LastRow = Sheets("[COLOR=#ff0000]Weekly Placements[/COLOR]").UsedRange.Rows.Count

    Sheets("Source Data2").Range("C4:N4").Copy Sheets("Weekly Placements").Range("B" & LastRow + 1)   'In the same line

Or

Code:
    Dim LastRow As Long
    LastRow = Sheets("[COLOR=#ff0000]Weekly Placements[/COLOR]").UsedRange.Rows.Count
    Sheets("Source Data2").Range("C4:N4").Copy
    Sheets("Weekly Placements").Range("B" & LastRow + 1).PasteSpecial xlAll
 
Upvote 0
Does this do it?

Code:
Sub Weekly()
Dim LR As Long
Sheets("Weekly Placements").Activate
LR = Cells(Rows.Count, "A").End(xlUp).Row
Cells(LR + 1, 1).Value = Date
Cells(LR + 1, 1).NumberFormat = "m/d/yyyy"
Range("B" & (LR + 1) & ":M" & (LR + 1)) = Sheets("Source Data2").Range("C4:N4").Value
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

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