Paste to first empty cell after a specific cell

happydonut

Board Regular
Joined
Nov 28, 2019
Messages
57
Office Version
  1. 365
Platform
  1. Windows
Hey guys,

I want to copy a range from Sheet1 (example column F starting from row 2) and paste it in another column in Sheet2 in the first empty cell starting from B6. Can anyone help with the code?
What I have done so far, which not works:

VBA Code:
Dim ws as Worksheeet
Dim ws2 as Worksheet

Set ws = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")

Dim wsLR As Long, ws2LR As Long

wsLR = ws.Cells(Rows.Count, "A").End(xlUp).Row
ws2LR = ws2.Cells(Rows.Count, "A").End(xlUp).Row

    ws.Range("F2:F" & wsLR).Copy
    ws2.Range("B6:B" & ws2LR).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
What I have done so far, which not works:
Good to show us what you have tried, but just saying it doesn't work gives us little to go on. Best to say if it
- Gives an error? What error on what line?
- Crashes excel
- Does nothing
- Pastes in the wrong place? Where did it paste?
etc

In any case, give this a try

VBA Code:
Dim ws As Worksheet
Dim ws2 As Worksheet

Set ws = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")

Dim wsLR As Long, ws2LR As Long

wsLR = ws.Cells(Rows.Count, "F").End(xlUp).Row
If wsLR > 1 Then
ws2LR = ws2.Cells(Rows.Count, "B").End(xlUp).Row
If ws2LR < 5 Then ws2LR = 5
  ws.Range("F2:F" & wsLR).Copy
  ws2.Range("B" & ws2LR + 1).PasteSpecial xlPasteValues
  Application.CutCopyMode = False
End If
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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