+ Reply to Thread
Results 1 to 5 of 5

Copy portion of filtered list

Hybrid View

tcowen61 Copy portion of filtered list 07-07-2009, 11:14 AM
StephenR Re: Copy portion of filtered... 07-07-2009, 11:52 AM
tcowen61 Re: Copy portion of filtered... 07-07-2009, 12:42 PM
StephenR Re: Copy portion of filtered... 07-07-2009, 12:55 PM
tcowen61 Re: Copy portion of filtered... 07-07-2009, 01:31 PM
  1. #1
    Registered User
    Join Date
    11-17-2008
    Location
    Texas
    Posts
    15

    Copy portion of filtered list

    I need the VB code to copy just a portion of a filtered list. I have completed the code to sort and filter the list. I'm having a problem determining how to define the region needed. I have searched the forums and found a few helpful threads but nothing specific. Most show selecting all the columns of the filtered list.

    My list is in columns A:AA and begins in row 4 (header row). In my test data, there are 5,900+ records and filtered list is approximately 4,900 records.

    Since I have sorted the data, the portion of the filtered data I need will always begin in cell D5, be columns D:K, and be the visible rows.

    Your assistance would be greatly appreciated!
    Last edited by tcowen61; 07-07-2009 at 01:31 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Copy portion of filtered list

    Like this perhaps?
    Sub x()
    
    Dim rng As Range
    
    Set rng = Range("D5", Range("K" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
    
    End Sub

  3. #3
    Registered User
    Join Date
    11-17-2008
    Location
    Texas
    Posts
    15

    Re: Copy portion of filtered list

    Thanks Stephen. It is close. I understand your code but it does not select the range once it is defined. Or, do I need to select the defined range.
    I'm still somewhat new at vb and do most things by using recorder, trial and error, or what I can pull from internet and this forum. So, I apologize if I missed the obvious.

    I'm attaching a small sample of data.

    Thanks for your assistance.
    Attached Files Attached Files
    Last edited by tcowen61; 07-07-2009 at 12:54 PM.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Copy portion of filtered list

    No, you don't need to select the range. To copy it you could use
    Sub x()
    
    Dim rng As Range
    
    Set rng = Range("D5", Range("K" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
    
    rng.Copy Sheet2.Range("A1")
    
    End Sub

  5. #5
    Registered User
    Join Date
    11-17-2008
    Location
    Texas
    Posts
    15

    Re: Copy portion of filtered list

    Thank you very much Stephen! The code works perfect.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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