+ Reply to Thread
Results 1 to 6 of 6

VBA to fill down multiple columns after applying filter

Hybrid View

kknb0800 VBA to fill down multiple... 03-19-2017, 01:27 PM
xladept Re: VBA to fill down multiple... 03-19-2017, 02:18 PM
kknb0800 Re: VBA to fill down multiple... 03-19-2017, 02:27 PM
xladept Re: VBA to fill down multiple... 03-19-2017, 02:29 PM
xladept Re: VBA to fill down multiple... 03-19-2017, 06:02 PM
kknb0800 Re: VBA to fill down multiple... 03-21-2017, 05:17 PM
  1. #1
    Registered User
    Join Date
    05-13-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    20

    VBA to fill down multiple columns after applying filter

    Hi,

    I've been stuck trying to figure out the below problem as was hoping to get some assistance.

    I have the below table and would like to filter on column C where value = 2 and then fill down range from D3 to I3 down on this filtered data. This range of cells all have formulas in them. I have searched and could only find solutions for I couldn't find anything that fills multiple columns.

    col A col B col C col D col E col F col G col H col I
    1 car 1 abc def ghi jkl mno pqr
    1 car 2 =D1 =E1 =F1 =G1 =H1 =I1
    1 car 1 abc def ghi jkl mno pqr
    1 car 2
    1 car 1 abc def ghi jkl mno pqr
    1 car 2
    1 car 1 abc def ghi jkl mno pqr
    1 car 2

    Therefore, the end result would be:

    col A col B col C col D col E col F col G col H col I
    1 car 1 abc def ghi jkl mno pqr
    1 car 2 =D1 =E1 =F1 =G1 =H1 =I1
    1 car 1 abc def ghi jkl mno pqr
    1 car 2 =D3 =E3 =F3 =G3 =H3 =I3
    1 car 1 abc def ghi jkl mno pqr
    1 car 2 =D5 =E5 =F5 =G5 =H5 =I5
    1 car 1 abc def ghi jkl mno pqr
    1 car 2 =D7 =E7 =F7 =G7 =H7 =I7

    Many thanks in advance
    Last edited by kknb0800; 03-19-2017 at 01:32 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA to fill down multiple columns after applying filter

    Try this:

    Sub KKNBX(): With ActiveSheet.UsedRange
    .AutoFilter Field:=3, Criteria1:="=2"
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-2]C"
    .AutoFilter
    End With: End Sub
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    05-13-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to fill down multiple columns after applying filter

    Quote Originally Posted by xladept View Post
    Try this:

    Sub KKNBX(): With ActiveSheet.UsedRange
    .AutoFilter Field:=3, Criteria1:="=2"
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-2]C"
    .AutoFilter
    End With: End Sub
    Thanks for your reply. Unfortunately, that didn't work. It errors saying "No cells were found"

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA to fill down multiple columns after applying filter

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA to fill down multiple columns after applying filter

    I just realized that all you really need is this:

    Sub KKNBX(): With ActiveSheet.UsedRange
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-2]C"
    End With: End Sub

  6. #6
    Registered User
    Join Date
    05-13-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to fill down multiple columns after applying filter

    Thank you and apologies for not replying sooner. I've been travelling and didn't have access to a computer.

    I tried your solution but I unfortunately get #REF error. I have attached an example of the data.

    Thanks again
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Applying a filter on the same Data in Multiple Sheets
    By lexskoza in forum Excel General
    Replies: 6
    Last Post: 03-07-2017, 09:34 AM
  2. Applying a filter to a PivotTable based on a cell
    By seanpcorbett1 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-15-2016, 02:00 PM
  3. [SOLVED] Applying an auto filter based on the value in a list box.
    By liamfrancis2013 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-08-2016, 10:06 AM
  4. Applying Multiple Filter Criteria in one column of Excel
    By Philipsfn in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 07-14-2014, 05:29 PM
  5. excel 2007 - applying filter ONE column only.
    By daniva92 in forum Excel General
    Replies: 6
    Last Post: 11-06-2013, 12:39 PM
  6. Applying a filter based on a value in a drop down list
    By Melyssa18 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-20-2011, 11:56 PM
  7. Applying a filter to multiple sheets
    By LemonTwist in forum Excel General
    Replies: 2
    Last Post: 07-15-2008, 04:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1