+ Reply to Thread
Results 1 to 10 of 10

Copy filtered data, not header

Hybrid View

melbri Copy filtered data, not header 12-07-2010, 02:23 PM
JBeaucaire Re: Copy filtered data, not... 12-07-2010, 03:54 PM
melbri Re: Copy filtered data, not... 12-07-2010, 04:04 PM
JBeaucaire Re: Copy filtered data, not... 12-07-2010, 04:12 PM
melbri Re: Copy filtered data, not... 12-07-2010, 04:23 PM
JBeaucaire Re: Copy filtered data, not... 12-07-2010, 04:53 PM
melbri Re: Copy filtered data, not... 12-07-2010, 05:01 PM
JBeaucaire Re: Copy filtered data, not... 12-07-2010, 05:09 PM
melbri Re: Copy filtered data, not... 12-07-2010, 05:52 PM
JBeaucaire Re: Copy filtered data, not... 12-07-2010, 07:22 PM
  1. #1
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copy filtered data, not header

    Ok, let's change the method of LR discovery. Is column A a good option? Is row 1 a good option for LC? It's always visible, right?

    Option Explicit
    
    Sub CopySpecial()
    Dim LR As Long, LC As Long
    Dim ws As Worksheet
    
    For Each ws In Sheets(Array("FLR", "PLC", "KWT", "KRP", "SWS", "KTO"))
        With ws
            LR = .Range("A" & .Rows.Count).End(xlUp).Row
            LC = .Cells(1, .Columns.Count).End(xlToLeft).Column
            
            If LR > 1 Then
                .Range(.Cells(2, 1), .Cells(LR, LC)).SpecialCells(xlCellTypeVisible).Copy _
                    Sheets("Log").Cells(Rows.Count, "A").End(xlUp).Offset(1)
            End If
        End With
    Next ws
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  2. #2
    Registered User
    Join Date
    11-05-2010
    Location
    Calgary
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy filtered data, not header

    Your first bit of code seems to work fine, but the second works only if there is data. If the filter does not have any data, the code does notlike it.

    I attempted to do a ws similar to what I am working wit, but both sets of code worked on it. Maybe it has to do with that I am pulling the data from sharepoint.

+ 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