+ Reply to Thread
Results 1 to 6 of 6

Excel VBA - Copying Dynamic Range without Headers - Issue

  1. #1
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2016
    Posts
    110

    Excel VBA - Copying Dynamic Range without Headers - Issue

    Dear all,

    I'm trying to copy dynamic range of data from one sheet to another without headers.

    Selection to copy the range of data doesn't work when values are missing in the 2nd column(for ex.).

    PFA.

    Input 1 sheet contains data with no blanks. Range Selection works without any issues.

    Input 2 sheet contains data with few blank. Range Selection doesn't work as expected and selects only few columns.

    Debug with two inputs. Kindly modify the code depending on the sheet you have chosen as Input.

    The issue is in the below Code:
    Please Login or Register  to view this content.
    Need your help to make this work for any kind of data.

    P.S. I can ensure that the 1st column will not have any blanks in starting or in between.

    Thanks,
    Vinod Krishna

  2. #2
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Excel VBA - Copying Dynamic Range without Headers - Issue

    Hi Vinod,

    I would recommend to make use of the Cells.Find function like this to be grabbing all of the data from your sheet, even when there is missing data:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2016
    Posts
    110

    Re: Excel VBA - Copying Dynamic Range without Headers - Issue

    Dear rkey,

    Thank you for the code. Works like a Charm on any kind of input

    Wish the code would have been a few liner

    Regards,
    Vinod Krishna

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Excel VBA - Copying Dynamic Range without Headers - Issue

    FWIW:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2016
    Posts
    110

    Re: Excel VBA - Copying Dynamic Range without Headers - Issue

    Dear John,

    Thank you for the simplifying things

    I'm trying to use your code as a Reusable Code.

    Could you please help me only with " Selecting the Range; and Copying " logic?

    P.S The no. of rows and columns will keep varying on a monthly basis.

    Thanks,
    Vinod Krishna

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Excel VBA - Copying Dynamic Range without Headers - Issue

    Vinod:

    The code as written will copy all rows and columns in the activesheet except row1 (ie .UsedRange) irregardless of the number or rows or columns and paste too Sheets("Output"). And place the copied cells one row below the last used cell in Column A in Sheets("Output"). (ie Range("A" & rows.count).End(3)(2). BTW Range("A" & rows.count).End(3)(2) is a shorter version of Range("A" & rows.count).(xlUp).Offset(1,).

+ 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. [SOLVED] Issue w/dynamic named range causing Excel to crash
    By plasmas222 in forum Excel General
    Replies: 10
    Last Post: 03-07-2014, 08:18 PM
  2. [SOLVED] Dependent drop down lists- dynamic data range- excluding Headers
    By strud in forum Excel General
    Replies: 3
    Last Post: 05-28-2013, 04:10 AM
  3. Defining and copying a dynamic named range in Excel for Mac 2011
    By travellerva in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2012, 06:09 PM
  4. ClearContents all rows except headers in a dynamic range
    By jdfjab in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2012, 02:24 PM
  5. Replies: 3
    Last Post: 07-29-2010, 02:27 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