+ Reply to Thread
Results 1 to 4 of 4

Help: FillDown doesn't work properly when only one line of data

  1. #1
    Registered User
    Join Date
    07-28-2011
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2007
    Posts
    7

    Help: FillDown doesn't work properly when only one line of data

    I'm having problems with the code I've been running in my macro. The problem areas run from " 'Insert Org ID" to " 'Moving columns" (I tried highlighting it red but it didn't work). Essentially, the code pulls data from three text files, adds columns, copies all the data from the last two text files to the first text file, adds and moves columns there, and then moves columns A:H of the final set to the template.

    The problem is that when the text files have only one line of data, the commands to copy and FillDown to the End of the Selection end up copying down the ENTIRE worksheet, and then when it goes to copy and paste, it brings up an error saying "Copy area is larger than paste area", and stops the macro.

    I have tried multiple times to fix this, but nothing I have done works. I really need this to work whether there is one line of data or 10,000 lines of data, or whatever ends up being the case. Ideas?

    Here's my code:
    Please Login or Register  to view this content.
    Last edited by Figgylynn1023; 08-01-2011 at 04:54 PM. Reason: color did not show up

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,103

    Re: Help: FillDown doesn't work properly when only one line of data

    Maybe, something like:

    Please Login or Register  to view this content.

    In this case, if you only have data in cell B1,

    Please Login or Register  to view this content.

    gives you 1 (one).

    So, you end up with:

    Please Login or Register  to view this content.


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-28-2011
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Help: FillDown doesn't work properly when only one line of data

    Thank you! This worked brilliantly!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,103

    Re: Help: FillDown doesn't work properly when only one line of data

    You're welcome.

+ 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