none
fill down, multiple columns RRS feed

  • Question

  • Good morning all.

    I have recorded a macro, and want to extend it to the rest of the columns, so I don't have to keep adjusting it for new columns.

    I tried to just add copies of the recorded code, but found that it won't recognize even the first one, when I do that.

    Selection.AutoFill Destination:=Range("DX4:DX3785"), Type:=xlFillDefault

    It appears that the active cell is supposed to be on the first cell to work, and won't shift over to the next column in my grouping.

    The offset is 6 columns, fill down, 6 columns, fill down, etc.....

    The contents are already set, I just need to fill down to the end of the range.

    How would I accomplish this?

    TYIA.

    Wednesday, January 11, 2017 4:08 PM

All replies

  • Not sure why you need AutoFill. Autofill works on pattern not on exact value.

    If you want value of DX4:DX3785 be set as selection's value, try like below

    Range("DX4:Dx3785").value=Selection.Value

    Remember rows of selection area must divide number of rows of range DX4:DX3785 area.


    Best Regards,
    Asadulla Javed,
    Jadavpore & Asansol

    Thursday, January 12, 2017 9:16 AM
    Answerer
  • Not sure why you need AutoFill. Autofill works on pattern not on exact value.

    If you want value of DX4:DX3785 be set as selection's value, try like below

    Range("DX4:Dx3785").value=Selection.Value

    Remember rows of selection area must divide number of rows of range DX4:DX3785 area.


    Best Regards,
    Asadulla Javed,
    Jadavpore & Asansol

    Hi.

    Thank you for your response. I just used that single column as an example.

    I need to iterate through multiple columns. Hence, my recording the macro, and looking for a means to do this.

    Thank you.

    Thursday, January 12, 2017 5:09 PM
  • Hi,

    Please visit Range.AutoFill Method (Excel)

    Destination

    Required

    Range

    The cells to be filled. The destination must include the source range.

    For example, if the source range is "A1", if you want to autofill "A1:D3", you need to autofill twice: horizontal and vertical filling.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 13, 2017 6:49 AM
    Moderator
  • Hi,

    Please visit Range.AutoFill Method (Excel)

    Destination

    Required

    Range

    The cells to be filled. The destination must include the source range.

    For example, if the source range is "A1", if you want to autofill "A1:D3", you need to autofill twice: horizontal and vertical filling.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Good morning Celeste.

    Ok. This won't work in my case either. I have a six-column gap between each grouping of the data I want to fill down. So, this configuration you've stated won't work.

    I know there's a way to do this, but I'm not finding it.

    Thank you anyway.

    Thursday, January 19, 2017 4:19 PM
  • I suggest you share a sample data and your expected result here, so we could help you check how to code.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 20, 2017 7:41 AM
    Moderator