here you have something :

If ExcelApp2.Worksheets(tp).Range("A" & r).Value Is Nothing Then
you should have r.tostring

to know where is the error would help a lot...