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: 7
Default Comparing Multidimensional Arrays?

Hello,
I have coded the following, but am wondering if there is a better way of
doing this.

Basically i'm comparing two 3D arrays, to see if the data from array1 is in
array2.
If it isn't, i'm copying the data over to the sheet.

heres the code and any help to do this a quicker way would be appreciated.
right now the code takes 5 minutes to run when MFArray is 2500 rows and
SNArray is 16,000 rows.

Thank you.


Public Sub CompareArrays()
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
Dim MFArray As Variant
Dim SNArray As Variant
Dim Match As String
Dim MFArrayEnd As Integer
Dim SNArrayEnd As Integer

MFArrayEnd = Sheets("MFrameAENames").UsedRange.Rows.Count
SNArrayEnd = Sheets("SalesnetAENames").UsedRange.Rows.Count
MFArray = Sheets("MFrameAENames").Range("A2:C" & MFArrayEnd).Value
SNArray = Sheets("SalesnetAENames").Range("A2:C" & SNArrayEnd).Value


For a = 1 To MFArrayEnd - 1
Match = "No"

Do Until Match = "Yes"
For b = 1 To SNArrayEnd - 1
If MFArray(a, 1) = SNArray(b, 1) And MFArray(a, 2) =
SNArray(b, 2) And MFArray(a, 3) = SNArray(b, 3) Then
Match = "Yes"
Else
End If
Next b
Exit Do
Loop

If Match = "No" Then
Sheets("MFrameAENames").Select
Range("A" & a + 1 & ":S" & a + 1).Select
Selection.Copy
Sheets("SalesnetAENames").Select
Range("A" & ActiveSheet.UsedRange.Rows.Count + 1).Select
ActiveSheet.Paste
Else
End If
Next a
With Application
CalcMode = .Calculation
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
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
ReDim, Preserve and Multidimensional arrays Andy Westlake[_2_] Excel Programming 3 October 19th 04 07:04 PM
Declare Multidimensional Arrays Alan Beban[_3_] Excel Programming 3 August 21st 03 02:40 AM
Declare Multidimensional Arrays Alan Beban[_3_] Excel Programming 0 August 20th 03 07:03 PM
Multidimensional Arrays - VBA Brent McIntyre Excel Programming 3 August 11th 03 09:01 AM
Multidimensional Arrays - VBA Brent McIntyre Excel Programming 14 August 8th 03 10:49 PM


All times are GMT +1. The time now is 06:51 PM.

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

About Us

"It's about Microsoft Excel"