Autofill xldown offset three columns

Bench

Board Regular
Joined
Aug 27, 2009
Messages
134
Hi,

I've used the following formula many times to autofill to the last row based upon the adjacent column

Code:
Range("D5").AutoFill Destination:=Range("D5", Range("D5").Offset(0, -1).End(xlDown).Offset(0, 1))

For the code i'm currently writing Column's B & C will always have gaps in their data, therefore it needs to autofill based upon Column A, i've tried various modifications to try and accomplish but without success. Sure it's something fairly simple.

Your thoughts would be appreciated

Thanks

Ben
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
46,145
Office Version
  1. 365
Platform
  1. Windows
Range("A" & Rows.Count).End(xlUp)

This gives the bottom cell in column A. You should be able to use that with an Offset to achieve your goal,
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,275
This will fill column C based on Column A

Code:
Range("C5").AutoFill Destination:=Range("A5", Range("A5").End(xlDown)).Offset(0, 2)

Or this...
Code:
Range("C5").AutoFill Destination:=Range("C5", Range("A5").End(xlDown).Offset(0, 2))
 
Last edited:

Bench

Board Regular
Joined
Aug 27, 2009
Messages
134
Range("A" & Rows.Count).End(xlUp)

This gives the bottom cell in column A. You should be able to use that with an Offset to achieve your goal,

Thanks, i'm still quite a beginner with VBA so not sure exactly how to execute that in code :(

Been playing a bit more and have come up with the below, this is so close to working, just fills down one short of where it needs to be.

Code:
Range("D5").AutoFill Destination:=Range("D5", Range("D5").Offset(0, -1).End(xlDown).Offset(4, 1))
 

Bench

Board Regular
Joined
Aug 27, 2009
Messages
134
thanks for your help folks, this one worked for me in the end

Code:
Range("D5").AutoFill Destination:=Range("D5", Range("A5").End(xlDown).Offset(-1, 3))
 

Watch MrExcel Video

Forum statistics

Threads
1,108,452
Messages
5,523,068
Members
409,496
Latest member
SWH

This Week's Hot Topics

Top