kashif.special2005
Active Member
- Joined
- Oct 26, 2009
- Messages
- 443
I All,
I have two sheets 1st is called "AADB" and second is called "MDT Access"
AADB have around 200000 rows and 20 columns data, and MDT Access have around 2000 rows and 5 columns data
I want to updating the sheet "Result" with data on below conditions.
I am applying loop on each row in the sheet AADB and in the column 2, if that loop cell column 2 value is available in the sheet MDT Access column 1 and if loop cell column 13 value from the sheet AADB is available in the sheet MDT Access column 4 then update the array with the loop row data of all columns of the sheet AADB.
Note:- FundID are duplicates in both the sheet.
FundID is Column 2 in The sheet AADB, and FundID is column 2 in MDT Access.
Please kindly request to all excel experts please help me on this problem.
Thanks in advance.
Thanks
Kashif
I have two sheets 1st is called "AADB" and second is called "MDT Access"
AADB have around 200000 rows and 20 columns data, and MDT Access have around 2000 rows and 5 columns data
I want to updating the sheet "Result" with data on below conditions.
I am applying loop on each row in the sheet AADB and in the column 2, if that loop cell column 2 value is available in the sheet MDT Access column 1 and if loop cell column 13 value from the sheet AADB is available in the sheet MDT Access column 4 then update the array with the loop row data of all columns of the sheet AADB.
Note:- FundID are duplicates in both the sheet.
FundID is Column 2 in The sheet AADB, and FundID is column 2 in MDT Access.
Code:
Sub QCCombineArrays()
Dim varAADBinfo As Variant, MDTPIAccessInfo As Variant, varCombineArray As Variant
Dim LastRow As Long, intdisplayrow As Long, Row As Long, Y As Long
LastRow = Sheets("AADB").Cells(Rows.Count, "A").End(xlUp).Row
varAADBinfo = Sheets("AADB").Range("A3:S" & LastRow).Value2
LastRow = Sheets("MDT Access").Cells(Rows.Count, "A").End(xlUp).Row
MDTPIAccessInfo = Sheets("MDT Access").Range("A3:E" & LastRow).Value2
ReDim varCombineArray(UBound(varAADBinfo, 1), UBound(varAADBinfo, 2)) As Variant
For Row = 1 To UBound(MDTPIAccessInfo, 1)
For Y = 1 To UBound(varAADBinfo, 1)
'varAADBinfo(, 2)=FundID
'MDTPIAccessInfo(, 1)=FundID
'varAADBinfo(, 14)=Trans_Date
'MDTPIAccessInfo(, 3)=TransDate
If varAADBinfo(Y, 2) = MDTPIAccessInfo(Row, 1) And varAADBinfo(Y, 14) = MDTPIAccessInfo(Row, 3) Then
'AADB info
For Column = 1 To UBound(varAADBinfo, 2)
varCombineArray(intdisplayrow, Column) = varAADBinfo(Y, Column)
Next Column
'QCer info from PI Database
'MDTPIAccessInfo(Row, 4)=QCPerson
varCombineArray(intdisplayrow, 11) = MDTPIAccessInfo(Row, 4)
intdisplayrow = intdisplayrow + 1
End If
Next Y
Next Row
ActiveSheet.Range(Cells(14, 2), Cells(UBound(varCombineArray, 1) + 14, UBound(varCombineArray, 2) + 2)) = varCombineArray
End Sub
Please kindly request to all excel experts please help me on this problem.
Thanks in advance.
Thanks
Kashif