+ Reply to Thread
Results 1 to 4 of 4

Cells.Find Function not working when used 100x in 1s

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    Bratislava
    MS-Off Ver
    Excel 2010
    Posts
    8

    Cells.Find Function not working when used 100x in 1s

    Hi Everybody,

    I am writing a macro that uses data from a spreadsheet with over a 10K rows and around 20 columns. Its exported from Access, as in my opinion it is quicker to use data in a excel sheet as always calling a database.

    Anyway to locate the right column and right row i use cells.find function. Its run a few hundred times in a second and it finds nothing even when the data are there. I am sure the code is written correctly because if I step into the macro and go line by line the cells.Find functions find every single piece of data, without problems. It seams to have problem with the count of times I need to use it.

    Part of the code:

    Please Login or Register  to view this content.
    Anyone has experience with this? Do I need to call the Database server for each value/row/column or is there a way how to fix this?

    Thank you for any help,
    Best Regards,
    Shuter

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Cells.Find Function not working when used 100x in 1s

    Shuter1,

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Cells.Find Function not working when used 100x in 1s

    Hi, Shuter1,

    Its run a few hundred times in a second...
    Due to the information you deliver it seems to me you import the whole set into Excel but it´s not clear what you looking for and why it has happen so many times.

    If Find is really troublesome in your project please try to use WorksheetFunction.Match instead which should deliver the row while Find would give a range.

    BTW: why do you use SQLDateFormat instead of just Format, and what are Datum, Data, and Planeta like?

    Ciao,
    Holger

  4. #4
    Registered User
    Join Date
    06-06-2012
    Location
    Bratislava
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Cells.Find Function not working when used 100x in 1s

    arlu1201: I was thinking it works somehow automatically :-) Sorry, next time I do as you say in your signature.

    HaHoBe:
    Match did work perfectly. I needed to put the first column values and first row values in to a public array as Match did not want to read it from a Range or Variant type variable. But anyway it works and is still really fast.
    Thank you very much, Holger. This thread is solved.

    About your questions:
    I use a function instead just of format, because my data formats can change and I dont want to read the code searching for all places I changed the format because of the data.
    Data is a Worksheet. Datum and Planeta where strings to search for in the Data Worksheet.

    My new code:

    Please Login or Register  to view this content.
    Last edited by Shuter1; 08-29-2012 at 11:53 AM.

+ 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