+ Reply to Thread
Results 1 to 8 of 8

Condense Macro

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Condense Macro

    Hi Guys,

    I have been using this site for a while now but this is my first post.

    I have created a macro using the record macro feature in excel2010. Basically I have a bunch of data in sheet 1 and I need to move it to another Tab titled Asset Details. I was wondering if there was a way to condense the code down and not have it as long as it is. Thanks for taking the time to consider helping me out.



    Thanks
    Dan
    Attached Files Attached Files

  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,367

    Re: Condense Macro

    Simplest way ...

    This:

    Please Login or Register  to view this content.

    Becomes this:

    Please Login or Register  to view this content.

    Or:

    Please Login or Register  to view this content.

    Repeat ad nauseam.

    This is a little shorter but will be much quicker as it avoids sheet and cell selection.


    Better would be have two arrays of source and target cell references and loop through the arrays and use a construct like above with the range addresses replaced by array elements.


    Regards, TMS
    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
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Condense Macro

    See if this helps you out:
    Attached Files Attached Files
    Click on star (*) below if this helps

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Condense Macro

    Building on what TMS suggested, this is what I came up with:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Registered User
    Join Date
    08-22-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Condense Macro

    Thanks everyone, I will give them a try.

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Condense Macro

    Possibly:
    Please Login or Register  to view this content.
    Or maybe even:
    Please Login or Register  to view this content.

  7. #7
    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,367

    Re: Condense Macro

    Thanks for the rep.

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Condense Macro

    Thanks for the rep too

+ 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