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

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
45,918
Office Version
365
Platform
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,271
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))
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,055
Messages
5,509,057
Members
408,701
Latest member
daz457

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top