+ Reply to Thread
Results 1 to 10 of 10

any alternative method for looping?

  1. #1
    Forum Contributor
    Join Date
    08-04-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    143

    any alternative method for looping?

    Hi all, this is the code i have currently. it is working but takes too long to finish its task.
    Please Login or Register  to view this content.
    i tried this code with 500 entries and it took 1-2min to finish comparing. my real work sample has more than 60k entries, it will take ages to finish comparing. so i am thinking whether is there any alternative to make it run faster?

    thanks

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: any alternative method for looping?

    Instead of the outer loop, use Find to locate the data you are interested in in column A, then check column C and loop if required, or use an autofilter.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: any alternative method for looping?

    Can you explain verbally what is going on?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor
    Join Date
    08-04-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    143

    Re: any alternative method for looping?

    sheet "raw_data" is the master sheet with all data. i had a macro to copy some of the data from "raw data" to "manual selection" while "hidden sheet" will include the remaining data. so this macro will check to make sure that data that will be copied from "raw data" to "hidden sheet" is not in "manual selection".

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: any alternative method for looping?

    Please post a sample of those 2 sheets. There are many ways and methods to compare data. The most appropriate depends also on the structure of those sheets.



  6. #6
    Forum Contributor
    Join Date
    08-04-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    143

    Re: any alternative method for looping?

    there, i have upload my sample file. the looping macro is at sheet manual selection,"add road". please note that the real file will consist at least 60k entries or more. thanks
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    08-04-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    143

    Re: any alternative method for looping?

    uploaded xls format as requested
    Attached Files Attached Files

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: any alternative method for looping?

    Are you familiar with advancedfilter ?
    I think it can replace all your code by 2 lines of VBAcode.

  9. #9
    Forum Contributor
    Join Date
    08-04-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    143

    Re: any alternative method for looping?

    not at all. may i know what is the coding? thanks

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: any alternative method for looping?

    Yes you may: consult the topic in the VBEditor's help.

+ 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