+ Reply to Thread
Results 1 to 4 of 4

Search by a column, working but very slow after 1000's line

Hybrid View

  1. #1
    Registered User
    Join Date
    12-06-2014
    Location
    Maputo
    MS-Off Ver
    2013
    Posts
    4

    Search by a column, working but very slow after 1000's line

    Hello grand community,
    I have 'created' a search on excel (massively with a help of youtube lessons).
    Its rather simple and it works
    I'm doing a job for a firm that has thousands of registries (2,000 +/-) with 44 columns each.

    Private Sub Bot_PesquisarRegistos_Click()
    If PesquisarNO = "" Then 
        ' PesquisarNO it's a textbox, this code its on a button next to the textbox (please, see image attached)
        MsgBox "Field empty, please write a NO number", vbInformation, "Alert"
        PesquisarNO.SetFocus
    Else
        Range("a6").Select ' before A6 there is lots of things that doesn't matter for the search. 
        Do
            ActiveCell.Offset(1, 0).Select
            If ActiveCell.Text = "" Then
                MsgBox "No registry found with the NO:" & PesquisarNO & " supplied. Try again", vbInformation, "Alert"
                PesquisarNO = ""
                PesquisarNO.SetFocus
                Exit Sub
            End If
        Loop Until ActiveCell.Text = PesquisarNO
        CarregaDados ' A subrotine that fills with the data on the current line on the excel sheet into the fields on the form.
        PesquisarNO = ""
        PesquisarNO.SetFocus
    End If
    End Sub
    2.gif

    This is very nice but for the first 1,000 records. After that it starts to take too long (5 seconds + ) to find a line that obeys the condition.
    My question is... Is there a better way to do a search ? a faster way with some internal function that I don't know about.

    Thank you for any help you can give me and thank you for your time in advanced
    Orion
    Last edited by Proditech Orion; 12-18-2014 at 06:00 PM. Reason: code tags added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,992

    Re: Search by a column, working but very slow after 1000's line

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    12-06-2014
    Location
    Maputo
    MS-Off Ver
    2013
    Posts
    4

    Re: Search by a column, working but very slow after 1000's line

    My sincere apologies...
    I already cleaned what I have done...
    Thank you.
    Orion
    Last edited by Proditech Orion; 12-18-2014 at 06:01 PM.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Search by a column, working but very slow after 1000's line

    Hi Proditech Orion

    Many of us can't view Images on this Forum. Why? I don't know. The issue has been reported many times to Forum Management but continues to exist.

    Having said that...

    Pictures are of little value.

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and, if appropriate, an "After" of what you wish the output to be.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. multi-line VBA not working after column order change
    By cmccabe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-10-2014, 05:52 PM
  2. Excel sheet with over 1000 index/match array functions too slow
    By jcmc2112 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-17-2014, 03:17 PM
  3. Search for a line in all Modules in a workbook and add extra line below
    By sans in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2013, 03:17 PM
  4. Creating a find method to search a number between 1000 - 10,000
    By Astroboy142 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-06-2009, 02:25 PM
  5. Continue formula to LINE 1000 without showing FALSE
    By chieron in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-08-2005, 08:55 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