+ Reply to Thread
Results 1 to 11 of 11

Is there a way to simplify my code?

  1. #1
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    Is there a way to simplify my code?

    Hi,

    I have a spreadsheet which needs to perform the following actions
    1.) base on two range value (in Col A and B) in Worksheet1 to search and find the same value in Worksheet2 to Worksheet5
    2.) if can match the the value of WS1 in any of WS2 to WS5, then Copy particular cells from one of these WS to WS1

    My problem is that in reality, I got around 5000 row data in each WS2 to WS5 and around 1000 row data in WS1. I did try the code in the attachment, but it takes 38 seconds to fill just 27 rows.

    Can anyone tell me how should I simplify the code so that it can run faster.
    Thanks
    Attached Files Attached Files
    Last edited by lubbamkt; 06-09-2014 at 09:26 AM.

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Is there a way to simplify my code?

    Can you post the code to the forum?
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Is there a way to simplify my code?

    Here is the code.
    I reupload the workbook to the forum with elaboration, wish making it much easier to read. Thank you again!

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by lubbamkt; 06-06-2014 at 11:59 PM.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Is there a way to simplify my code?

    Please Login or Register  to view this content.
    Ben Van Johnson

  5. #5
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Is there a way to simplify my code?

    Hi protonLeah, thank you so much!

    Quote Originally Posted by protonLeah View Post
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Is there a way to simplify my code?

    Hi protonLeah,
    Is it possible to use array to first save the result and paste them only once after searching?

    Quote Originally Posted by protonLeah View Post
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189
    Can anyone give me a hand pls?
    English is not my first language

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Is there a way to simplify my code?

    I'll have a look Sunday.

  9. #9
    Forum Contributor
    Join Date
    11-12-2010
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    189
    Sure. Np. Thanks in advance

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Is there a way to simplify my code?

    Please Login or Register  to view this content.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Is there a way to simplify my code?

    See if this is faster.
    Please Login or Register  to view this content.

+ 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. How to simplify code?
    By RaquelAR in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2013, 07:30 AM
  2. [SOLVED] Simplify VBA Code
    By Sky188 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2012, 02:31 PM
  3. hi can anyone simplify this old bit of code
    By khalid79m in forum Excel General
    Replies: 3
    Last Post: 12-28-2006, 01:04 PM
  4. [SOLVED] Simplify Code
    By Soniya in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2006, 01:59 PM
  5. Simplify this code
    By Scott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 12:00 AM

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