473,804 Members | 3,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Slow For Loop with string matching in very large ranges

1 New Member
Hello! Please help someone... I am still at work and completely stumped. I am a relative beginner at VB and have put together some apparently awful code (as shown below). It is to compare two incredibly huge lists of strings (which might duplicate if I take out things like - (not sure if relevant!)), find matches and entering text next to each one. It is very slow and completes a loop about 4 times a minute (yes i have timed it). the annoying thing is, that it used to run quickly and now it hates me!!!!!

IDRange is 1D Range, but 15 000 rows long, and Restoring about 4000 long

How can i make it fast and why would it run quickly first and then run very slowly??? Please help... please!

Can email whole workbook if necessary.

Thanks, Becky


Expand|Select|Wrap|Line Numbers
  1. Sub UpdateRestoringNew()
  2.  
  3.   'Update Restoring, Ingested, Failed, Multiple Tapes and Recheck
  4.   Dim IDRange As Range, Restoring As Range, Ingested As Range, Failed As Range, _
  5.   Recheck As Range, MultipleTapes As Range, ResString As String, IDMatch As Range, _
  6.   CellCounterRes As Integer
  7.  
  8.   Sheets("Ingested Content").Select
  9.   Range("$D$5").Select
  10.   Set IDRange = Range(Selection, Selection.End(xlDown))
  11.  
  12.   Sheets("Tracking").Select
  13.   Range("$A$460").Select
  14.   Set Restoring = Range(Selection, Selection.End(xlDown))
  15.  
  16.   For CellCounterRes = 1 To Restoring.Cells.Count
  17.     ResString = Restoring.Cells(CellCounterRes).Value
  18.  
  19.     ' Restoring Update
  20.     Set IDMatch = IDRange.Find(What:=ResString, LookAt:=xlPart, LookIn:=xlValues)
  21.     If Not IDMatch Is Nothing Then
  22.       Restoring.Cells(CellCounterRes).Offset(0, 1).Cells(1).Formula = "Updated"
  23.       IDMatch.Offset(0, 1).Cells(1).Formula = "Restoring"
  24.     End If
  25.  
  26.   Next CellCounterRes
  27.  
  28. End Sub
Oct 17 '07 #1
0 1156

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3146
by: Shay | last post by:
essentially I am trying to do some counts based on some assumptions in the recordset. So I get the RS back, put the values into a variable, move to the next record in the RS and compare what is in the variable to the value in the next record in the recordset and do a count. Then overwrite the value in the variables and do the same for the next record and so. But this runs extremly slow. 5000 records takes about 10 minutes in IE6 and I...
11
17578
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time to load making any kind linkage with my Access data virtually useless. I have the MySQL driver setup in as a USER DSN. The MySQL data is sitting out on a server and the Access database is running locally. The network connection is very...
2
2022
by: Yonatan Goraly | last post by:
I am in the process of adding PostgreSQL support for an application, in addition to Oracle and MS SQL. I am using PostgreSQL version 7.3.2, Red Hat 9.0 on Intel Pentium III board. I have a query that generally looks like this: SELECT t1.col1, t2.col1 FROM t1, t2 WHERE t1.x=t2.y AND t2.p='string' AND t2.q=1 This query is strikingly slow (about 100 sec when both t1 and t2 has
3
4808
by: Janross | last post by:
I'm having trouble with a query that's prohibitively slow. On my free-standing office computer it's fine (well, 2-4 seconds), but on the client's network, it takes at least 5 minutes to run. Obviously not workable! I know where the problem is, I just don't know how to fix it. The query calls a function, and I assume it gets slow because the function runs on every record. So--is there a way to rewrite the function so it's quicker?...
7
2614
by: spike | last post by:
Im writing a program to search for a string in a binary file. And it works. The problem is: It is sooo slow! how can i make it faster? It takes 27 seconds just to search a 5 meg file. I guess it has something to do with the strequal() function... Btw, thanks to all of you who answered last time! code: ------------------------------------------------------------------------- #include <stdio.h>
7
1571
by: mp | last post by:
Hi, MS Access DB, C#, VS, SQL I have implemented search with SQL statements like follows: SQLString = "SELECT ENGLISH FROM MyTable WHERE ENGLISH LIKE '"+txtWordManipulation.Text+"%' ORDER BY ENGLISH"; end everything is desperately slow. DB is more than 150k words and I haven't defined primary key because indexed option is set on Yes (Duplicates OK).
4
2806
by: Lucas Tam | last post by:
Hi all, I'm concatenating a large SQL string for updating a table. There are > 80,000 commands (rows) in the SQL string. VB.NET seems to be *VERY* slow at string concatenation when the string gets large... Is it possible to execute a SQL command from a text file? .NET can streamwrite extremely fast so I was thinking of writing all the commands to a text file then executing the text file.
11
3152
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive takes 120 seconds). The Setup: I'm running Access 97 non-developer edition. I have exactly zero other tools to use and no way to change that =(. My database is compiled and resides on a network drive. The database has not been split into a...
0
10605
NeoPa
by: NeoPa | last post by:
ANSI-89 v ANSI-92 Before we get into all the various types of pattern matching that can be used, there are two ANSI standards used for the main types of wildcard matching (matching zero or more characters or simply matching a single character) : ANSI-89 - Mainly used only by Jet / ACE SQL ANSI-92 - Mainly used by SQL Server and other grown-up products In the later versions of Access it is now possible to select ANSI-92 compatibility as an...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.