Results 1 to 9 of 9

Copy only rows with data

Threaded View

tkbuc Copy only rows with data 09-25-2019, 01:31 PM
AlphaFrog Re: Copy only rows with data 09-25-2019, 04:21 PM
tkbuc Re: Copy only rows with data 09-25-2019, 04:44 PM
AlphaFrog Re: Copy only rows with data 09-25-2019, 09:17 PM
tkbuc Re: Copy only rows with data 09-25-2019, 10:13 PM
AlphaFrog Re: Copy only rows with data 09-26-2019, 06:21 AM
tkbuc Re: Copy only rows with data 09-26-2019, 08:19 AM
AlphaFrog Re: Copy only rows with data 09-26-2019, 07:11 PM
jeffreybrown Re: Copy only rows with data 09-26-2019, 07:22 PM
  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    110

    Copy only rows with data

    I have this macro below that is auto-filtering my data and copying only specific columns to a new sheet.

    The problem I am running into is that it is coping the entire column, including blank rows past the last row of data. How can I modify this to only copy the rows that have data?

    Sub C_Closed_Inventory()
    '
    ' Closed Macro
    '
    
    '
        Sheets("Data").Select
        Range("A1").Select
        Range("$A$1").Autofilter Field:=3, Criteria1:="Closed"
        Range("B:B,C:C,J:J,L:L,O:T,X:Z,AB:AC,AH:AK,AO:AS").EntireColumn.Hidden = True
        Columns("A:AN").SpecialCells(xlCellTypeVisible).Copy Sheets("Closed Inventory").Range("A1")
        Range("B:B,C:C,J:J,L:L,O:T,X:Z,AB:AC,AH:AK,AO:AS").EntireColumn.Hidden = False
        ActiveSheet.ShowAllData
    Last edited by jeffreybrown; 09-25-2019 at 01:34 PM. Reason: Please use code tags!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 05-24-2018, 04:48 AM
  2. Insert set number of rows between data and copy and paste data above empty rows
    By Orionm45 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2017, 11:35 AM
  3. Replies: 4
    Last Post: 01-23-2017, 08:10 AM
  4. [SOLVED] insert rows based on number in cell and copy the data down into the new rows
    By pziefle in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-05-2013, 11:19 AM
  5. [SOLVED] Insert Multiple Rows Based Off Number in Cell and Copy Data From Above New Rows
    By tstell1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 04:15 PM
  6. Replies: 1
    Last Post: 05-19-2011, 09:53 AM
  7. Replies: 2
    Last Post: 04-21-2011, 07:13 PM

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