+ Reply to Thread
Results 1 to 17 of 17

Copy a specific column data of filtered output without header

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Copy a specific column data of filtered output without header

    Hello All

    I have a filtered sheet, from which I have to copy the data of a specific column. But I don't want to copy the header.
    Suppose I have to copy the Column 'M' and there are 3 rows after filtering is done, how do I copy those 3 values of column M?
    I cannot do a offset(1,0) from "M1" to go to the first visible row .
    Please help.

    Thanks in advance.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    Try
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    Thanks very much. I need one more refinement.
    Instead of saying column "M", I have a range, which is the return value of a "find" function.
    How do I use this range to formulate a similar statement?
    ----
    Set ColNo = Cells.Find(What:="Domain", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole, _
    SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
    ----
    Now "ColNo" points to the cell, where "Domain" is present. "Domain" is in the first Row, i.e. the header.
    Now I have to copy hte data beneath "Domain".
    Can you please help me to formulate the statement

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    Try
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    It is not copying just one column. It is copying the the entire row.
    I used ColNo.column, instead of ColNo, because excel throws and error otherwise
    -------
    Please Login or Register  to view this content.
    -------
    Last edited by arlu1201; 11-01-2012 at 09:25 AM. Reason: Use code tags in future.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    I tested it at my end and it works fine. It shouldnt copy the entire row but only that column.

    Can you try again?

  7. #7
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    Yes I tried again. It is copying all the visible columns and rows.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    Upload your sample file with the whole code. Let me test.

  9. #9
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    I have attached the excelfile with data and macro
    Thanks for all your time
    Attached Files Attached Files

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    Why are you searching for Domain? Is it because that column can be in any column?

    So you want this output - ?

    For each row having FS in column A, the value in column F should be copied in Sheet2 column A?

  11. #11
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    Yes you are right. "Domain" value can be present in any column.
    And, for each row having FS in column A, I want to copy the corresponding "Domain" values into another sheet.

  12. #12
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    Hi, Can someone please help me out here.
    I have uploaded my excel with data and macro.
    Please let me know how I can copy 'visible filtered' data of a specific column , excluding the header, into another sheet.

  13. #13
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    Updated code -
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    Thanks very much. It works great

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.

  16. #16
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy a specific column data of filtered output without header

    Hi Arlette,
    There is a problem in this line of the code,
    NumFSRows = .Columns(1).Cells.SpecialCells(xlCellTypeVisible).Cells.Count - 1 'Subtract 1 for the Header
    The count is coming to 1048571, which is invalid. Since after filtering for "FS" there are only 4 rows including the header

  17. #17
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copy a specific column data of filtered output without header

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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