View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default My Never ending ARRAY code problems

Hi Howard,

Am Thu, 12 Feb 2015 12:56:19 -0800 (PST) schrieb L. Howard:

If you click button 1, see sheet three is 1 to 9 values only.

Click button 2 and desired results are posted on sheet 3.


I changed the code to:

Sub ColumnsCompareOne()

Dim i As Long, ii As Long

Dim LRow1 As Long, LRow2 As Long

Dim MyArr1 As Variant
Dim MyArr2 As Variant
Dim varData As Variant

Dim rngBig As Range

LRow1 = Sheets("Sheet1").Cells(Rows.Count, "C").End(xlUp).Row
MyArr1 = Sheets("Sheet1").Range("C2:C" & LRow1)
LRow2 = Sheets("Sheet2").Cells(Rows.Count, "H").End(xlUp).Row
MyArr2 = Sheets("Sheet2").Range("H2:H" & LRow2)
varData = Sheets("Sheet2").Range("A2:Z" & LRow2)

Application.ScreenUpdating = False

With Sheets("Sheet2")

For i = LBound(MyArr1) To UBound(MyArr1)
For ii = LBound(MyArr2) To UBound(MyArr2)
If MyArr1(i, 1) = MyArr2(ii, 1) Then
Sheets("Sheet3").Cells(Rows.Count, 1).End(xlUp)(2) _
.Resize(, 26) = Application.Index(varData, ii, 0)
Exit For
End If
Next 'ii
Next 'i

End With

Application.ScreenUpdating = True
End Sub

Or look he
https://onedrive.live.com/?cid=9378A...121822A3%21326
for "Book3"


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional