Copy values of range immediately below same range excel vba

drluke

Active Member
Joined
Apr 17, 2014
Messages
314
Office Version
  1. 365
Platform
  1. Windows
In my worksheet I have continuous rows with data in D7:D726. I column E I have data from E7:E24. I need to copy the data
in range E7:E24 and autofill the remaining rows in col E (i.e. E25:E726) with that range of values.

The ranges in both col D and the initial range to be copied in col E will never be the same.

So far I have tried this code:
Code:
Range("E7:E" & Range("D" & Rows.Count).End(xlUp).Row).Value = Range("E7:E" & Range("E" & Rows.Count) _
.End(xlUp).Row).Value
The result I'm getting (in E25:E726) is #N/A
Any advise much appreciated.
 
Re: Autofill syntax error

I'm getting a syntax error on this line of code:

Code:
Range("E7:E" & Range("E" & Rows.Count).End(xlUp).Row).AutoFill Destination:=Range("E7:E" & Range("D" & Rows.Count).End(xlUp).Row), xlFillValues

I can't work out what is wrong. Any advice appreciated.

My code in #5

Code:
    Range("E7:E" & Range("E" & Rows.Count).End(xlUp).Row).AutoFill _
         [COLOR=#0000ff]Destination[/COLOR]:=Range("E7:E" & Range("D" & Rows.Count).End(xlUp).Row), [COLOR=#0000ff]Type[/COLOR]:=xlFillValues



If you are going to put the argument name "Destination", then you must also put the argument name "Type"

Or omit the 2, as in the Fluff code:
Code:
    Range("E7:E" & Range("E" & Rows.Count).End(xlUp).Row).AutoFill _
            Range("E7:E" & Range("D" & Rows.Count).End(xlUp).Row), xlFillCopy
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Re: Autofill syntax error

Good spot Dante, I totally missed that.
 
Upvote 0
Re: Autofill syntax error

Thank you all - awesome as always!
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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