2017-07-03 8 views
0

まず、すべてのデータを配列に格納した後、それを列と比較します。それが一致する場合は、私は値のオフセットを取って、別の列に配置します。VBAで配列とセルを比較する

しかし、ここでは配列に「無効な修飾子」エラーが発生しています。私は間違って何をしていますか?

Sub database_updator() 

Dim dataa As Range, dataCel1 As Range, dataj As Range, datacel2 As Range, datazc As Range, datacel3 As Range, SrchRngaa As Range, cel As Range 

Dim data As String, datatext As String, PDS_NAME As String, Database_data As String 
Dim n As Integer, xx As Integer, z As Integer 
Set dataa = Range("a16:a100") 
Set datazc = Range("zc17:zc50") 
Set SrchRngaa = Range("a16:a100") 
Dim arr(1 To 85) As String 
x = 16 
For n = 1 To 85  'storing data into array 
    arr(n) = Range("yx" & x).Value 
    x = x + 1 
Next n 


' loop thorugh cells in column 
For Each dataCel1 In datazc 
    For n = 1 To 85 
     If arr(n) = dataCel1.Value Then 
      datatext = "true" 
     Exit For 
     End If 
    Next n 

' check if current value in column has a match in another column 
    If datatext = "true" Then 
     PDS_NAME = arr(n).Value ' ERROR OCCURS HERE 
    Database_data = dataCel1.Offset(0, 2).Value 
      For Each cel In SrchRngaa 
       If PDS_NAME = "" Then 

       Exit For 
       ElseIf cel.Value = PDS_NAME Then 

         cel.Offset(0, 2).Value = Database_data 

       Exit For 

       End If 
      Next cel 
    End If 




Next dataCel1 

End Sub 
+6

あなたは、配列のない '.Value'プロパティがありません.Value' – MiguelH

+0

' ARR(n)の中で ".Valueのを" 必要はありません。 '= arr(n)'だけを試してみてください。 – Ambie

答えて

0
PDS_NAME = arr(n).Value 

this should be changed to: 

PDS_NAME = arr(n)