+ Reply to Thread
Results 1 to 22 of 22

Copy Specific Columns from a Filtered Range

Hybrid View

  1. #1
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Copy Specific Columns from a Filtered Range

    Saarang,

    Are you putting headers into the Prod and Innov sheets? I can modify the code if you are not... but right now it would be best if you do, if not you will have a blank row at the top of those sheets with this code, but as I said it can be dealt with if required.
    Sub Saarang()
    
    Dim ws As Worksheet, wsprod As Worksheet, wsinn As Worksheet
    Dim lr As Long, i As Long
    
    Set ws = Worksheets("Source")
    Set wsprod = Worksheets("Prod")
    Set wsinn = Worksheets("Innov")
    lr = ws.Range("A" & Rows.Count).End(xlUp).Row
    For i = 5 To lr
        If ws.Range("L" & i).Text <> "#N/A" And ws.Range("W" & i).Value <> "Innov" Then
            wsprod.Range("A" & wsprod.Range("A" & Rows.Count).End(xlUp).Row + 1).Value = "Add"
            wsprod.Range("B" & wsprod.Range("A" & Rows.Count).End(xlUp).Row).Value = ws.Range("P" & i).Value
            wsprod.Range("C" & wsprod.Range("A" & Rows.Count).End(xlUp).Row).Value = ws.Range("F" & i).Value
        End If
        If ws.Range("L" & i).Text <> "#N/A" And ws.Range("W" & i).Value <> "Prod" Then
            wsinn.Range("A" & wsinn.Range("A" & Rows.Count).End(xlUp).Row + 1).Value = "Add"
            wsinn.Range("B" & wsinn.Range("A" & Rows.Count).End(xlUp).Row).Value = ws.Range("S" & i).Value
            wsinn.Range("C" & wsinn.Range("A" & Rows.Count).End(xlUp).Row).Value = ws.Range("F" & i).Value
        End If
    Next i
    
    End Sub
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  2. #2
    Valued Forum Contributor Saarang84's Avatar
    Join Date
    02-19-2009
    Location
    Chennai, India
    MS-Off Ver
    XL 2003 to 2010
    Posts
    812

    Re: Copy Specific Columns from a Filtered Range

    BIG thanks to Arkadi and K64 for their codes !! My requirement is resolved !!
    If my assistance has helped, there is a reputation icon * on the left hand corner below the post - you can show your appreciation to the user who has helped in resolving your requirement.

    If your requirement has been solved please mark your thread as Solved.
    In the menu bar above the very first post, select Thread Tools, then select "Mark this thread as Solved".

    Kindly use [FORMULA] or [CODE] tags when posting your code.

    Regards,
    Sarang

+ 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. Copy a specific row and a range of columns to next available row on another worksheet
    By monkey1184 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2013, 05:02 PM
  2. How to copy specific rows of filtered data using VB
    By Menaka in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2013, 01:46 PM
  3. Replies: 8
    Last Post: 04-04-2013, 08:02 PM
  4. copy specific range of rows and columns according to a cell value
    By archangel9999 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-26-2013, 03:41 PM
  5. How to copy a range of columns from sheet1 to sheet2 if the cell show a specific text
    By chermaine123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2011, 02:39 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