LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default comparing two arrays

There's got to be a faster way to do this, so I come to the brain trust asking for brainy guidance!
I am comparing two ranges, each with appx 7000 items in them. I want to see if an item in list1 is also in list2. If it is, i want to hide that row. Right now, I am going through list1, item by item, and comparing it to list2 item by item via a double loop to achieve this. The problem is that this results in appx 40,320,350 individual iterations of my loop, thus slowing things down considerably. Even with screen updating turned off this is taking quite a bit of time. Is there a way to make this run faster? below is my code:

Sub compare()
Application.ScreenUpdating = False
Dim todaycell As Range
Dim yesterdaycell As Range
For i = 1 To lastrow(Sheet9)
Set yesterdaycell = Sheet9.Range("a" & i)
For ii = 1 To lastrow(Sheet10)
Set todaycell = Sheet10.Range("a" & ii)
If yesterdaycell.Value = todaycell.Value Then
yesterdaycell.EntireRow.Hidden = True
End If
Next ii
Next i
Application.ScreenUpdating = True
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Arrays TangentMemory Excel Discussion (Misc queries) 2 May 13th 05 05:06 PM
Comparing Arrays KL Excel Worksheet Functions 9 December 3rd 04 08:58 PM
Comparing to Arrays [email protected] Excel Programming 0 August 31st 04 10:21 PM
Comparing to Arrays [email protected] Excel Programming 1 August 31st 04 10:09 PM
Comparing to Arrays [email protected] Excel Programming 0 August 31st 04 07:50 PM


All times are GMT +1. The time now is 08:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"