を必要に応じて、私は明確化の質問に答えることができます申し訳ありません.. ...
Sub MergeData()
Dim D1 As Worksheet
Dim D3 As Worksheet
Dim Rng As Range
Dim Arr1 As Variant
Dim Arr2 As Variant
Dim Rw1 As Long, Rw2 As Long
'IF you the master file and 1 of the other files first in excel
'you can just reference them like this, otherwise change this accordingly
Set D1 = Workbooks("CSV1").Sheet1
Set D3 = Workbooks("CSV3").Sheet1
'D3 is the masterFile
'Lets store its data in Arr1
Set Rng = D3.UsedRange
Arr1 = Rng.Value
'since your working on large files lets try keep memory usage down to a minimum
'we will work on 2 sheets at a time not all 3.
'Arr2 now contains the sheet (CSV1) we will extract data from
Set Rng = D1.UsedRange
Set Arr2 = Rng.Value
Set Rng = Nothing
'Notice the + 1, its to skip the headers in case your wandering
'This is the basic loop setup
For Rw1 = LBound(Arr1, 1) + 1 To UBound(Arr1, 1)
For Rw2 = LBound(Arr2, 1) + 1 To UBound(Arr2, 1)
If Arr(Rw1, 1) = Arr2(Rw2, 1) Then 'OR lcase(Arr(Rw1, 1)) = lcase(Arr2(Rw2, 1)) if letter case might be a problem
'we found a matching ID
'now im not sure exactly what you want to happen here.....
'do you want to check if the master file has all the data that the other file has
'if not then transfer the columns of data it is missing
'or should all the columns in the master file be updated with the new values in the other file.....
'This will change what code needs writing here
'we may need an aditional array to hold new values temporarily
End If
Next Rw2
Next Rw1
'After all data has been extracted
'this code will also depend on what happens above
'but something like this
'set rng = D1.Range("this will be the size of the array").Value = Arr1
End Subの
私だけ起動する2つのファイルをしたように、まったく同じコードは、第二のファイルのために使用されます。
抽出するデータと、マスターファイルなどの内容を置き換える場合は、さらに詳しく入力する必要があります。
[質問する](http://stackoverflow.com/help/how-to-ask)をご覧ください。 – findwindow
私はあなたが何を意味するかわからない、私はルールに従って、そのセクトインを読んで、私は自分の質問がかなり簡単だと信じています。混乱している部分はありますか? – Luke
あなたはそれを読んだけど、それを理解しましたか?もう一度お試しください。 – findwindow