Using a With statement copy down

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
721
Office Version
  1. 2016
Platform
  1. Windows
what can I change to make this work?

I'm trying to copy the data from D4 down to the last cell without having to "select" the sheet employees.

VBA Code:
With Sheets("Employees")
    .Range ("D4")
    .Range(Selection, Selection.End(xlDown)).Copy
End With

Thank you
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
What column determines the last row?
 
Upvote 0
What column determines the last row?
Technically D, but if I can't use the same column, I would use A.

I tried this, but it too didn't work :(

VBA Code:
.Range("D4:D" & .Range("A" & Rows.Count).End(xlUp).Row).Select
 
Upvote 0
Ok, try
VBA Code:
    .Range("D4:D" & .Range("A" & Rows.Count).End(xlUp).Row).FillDown
 
Upvote 0
I managed to get this to work

VBA Code:
Sheets("Employees").Range("D4:D" & Sheets("Employees").Range("A" & Rows.Count).End(xlUp).Row).Copy Sheets("All3").Range("D10:D500")
 
Upvote 0
I got you, how about
VBA Code:
With Sheets("Employees")
    .Range("D4:D" & .Range("A" & Rows.Count).End(xlUp).Row).Copy Sheets("All3").Range("D10")
End With
 
Upvote 0
Solution
I got you, how about
VBA Code:
With Sheets("Employees")
    .Range("D4:D" & .Range("A" & Rows.Count).End(xlUp).Row).Copy Sheets("All3").Range("D10")
End With

That did the trick, thank you
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,052
Messages
6,122,878
Members
449,097
Latest member
dbomb1414

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