Copy and Paste Row to a WS

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
158
I am trying to copy and paste projection amounts from the worksheet "SPS" to the worksheet "Data". I need the macro to find the first blank cell in column N and paste the information in the adjacent cell in Column O. For example, if the fist blank cell in column N is N13, I need the data to paste in O13. This should be the end results:
(Column L)
(Column M)
(Column N)
(Column O)
Pay Period For
Fiscal
Salary Actuals
Salary Projections
201831
Current
$ 52.97

201833
Current
$ 1,059.30

201834
Current
$ 52.97

201833
Current
$ 264.83

201834
Current
$ 1,271.16

201832
Current
$ 529.66


Current

$ 3,977.00

Current

$ 4,044.16

Current

$ 9,580.42

Current

$ 9,240.42

Current

$ 4,348.90

Current

$ 4,348.90

Current

$ 5,401.41

Current

$ 5,091.31

Current

$ 4,348.90

Current

$ 4,705.54

Current

$ 4,348.90

<tbody>
</tbody>

This is my coding but it is not working:

'Copy and paste Projection Amount from “SPS” to “Data”
Dim SPS As Worksheet
Set SPS =ThisWorkbook.Sheets("SPS+")
Dim Data As Worksheet
Set Data =ThisWorkbook.Sheets("Data")

Dim LastRowText As Long
Dim lastO As Long
Dim z As Long
Dim LastRowData2 As Long
LastRowData2 = Data.Cells(Rows.Count,8).End(xlUp).Row


Range("N3:N" &LastRowSPS2).Copy
With Data
lastO =.Range("N" & Rows.Count).End(xlUp).Row + 1
.Range("N"& lastO).PasteSpecial xlPasteColumnWidths
.Range("N"& lastO).PasteSpecial xlPasteValues
End With

For z = LastRowData2 To 2 Step -1
If Cells(z, 12).Value ="" Then
Cells(z, 14).CutDestination:=Data.Cells(z, 15)
End If

Next z
Can someone help me out please :)
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try
Code:
Dim SPS As Worksheet
Set SPS = ThisWorkbook.Sheets("SPS+")
Dim Data As Worksheet
Set Data = ThisWorkbook.Sheets("Data")

SPS.Range("N3", SPS.Range("N" & Rows.Count).End(xlUp)).Copy
With Data
   With .Range("N" & Rows.Count).End(xlUp).Offset(1, 1)
      .PasteSpecial xlPasteColumnWidths
      .PasteSpecial xlPasteValues
   End With
End With
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,740
Messages
6,126,586
Members
449,319
Latest member
iaincmac

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