Paste to last row

Mark F

Well-known Member
Joined
Jun 7, 2002
Messages
513
Office Version
  1. 365
Platform
  1. Windows
I have the following code

Selection.Copy
Range("F2:F26").Select
ActiveSheet.Paste

The code copies into range F2:F26. I would like to copy to between f2 and the last row of the sheet

I know this involves Xlup but cannot work out how

Can you help

Thanks

Mark
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi

I just want to copy a formula that is in F2 all the way to the last row

Thanks

Mark
 
Upvote 0
Based on your request, the following should work (assumes you're copying column A - change as needed).
Code:
Sub Copy_and_Paste()
Dim End_Row as Long

End_Row = Range("A" & Rows.Count).End(xlUp).Row

Range("A2:A" & End_Row).Copy Destination:=Range("F2:F26")
Application.CutCopyMode = False
End Sub
 
Upvote 0
Hi

I just want to copy a formula that is in F2 all the way to the last row

Thanks

Mark

Hi Mark

So you are copying a single cell and want to copy it to F2:F65536? Or how are you defining the last row? Is it based on some adjacent column that contains values?
 
Upvote 0
Sorry

Should have made it clearer.

I am looking to copy the formula that is in f2 all the way down column f to the last active row (xlup?), There will be contents in column A

MArk
 
Upvote 0
Try this...

Code:
Sub Copy_and_Paste() 
Dim End_Row as Long 

End_Row = Range("A" & Rows.Count).End(xlUp).Row 

Range("F2).Copy Destination:=Range("F3:F" & End_Row) 
Application.CutCopyMode = False 
End Sub
 
Upvote 0
A minor variation on Neil's code will suffice:

Code:
Sub Copy_and_Paste()
Dim End_Row as Long

End_Row = Range("A" & Rows.Count).End(xlUp).Row

Range("F2").Copy Destination:=Range("F2:F" & End_Row)
Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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