Hi,

I think your error may be here

wb = "name" & "x" & ".xls"
this will set wb to namex.xls

try

wb = "name" & x & ".xls"
and

wb2 = "name2" & y & ".xls"