aflatoon thanks but still gives the same error .actually I add this
If Not dic.exists(a(i, 3)) Then  
          Set dic(a(i, 3)) = CreateObject("Scripting.Dictionary")
            End If
             If Not dic(a(i, 3)).exists(a(i, 4)) Then Set dic(a(i, 3))(a(i, 4)) = CreateObject("Scripting.Dictionary")
this work up to this line
 dic(a(i, 2))(a(i, 3))(a(i, 4))(a(i, 5)) = a(i, 6)
gives error mismatch. my knowladge in vba is not good but I try learning . cany you guide me please?