lundi 20 avril 2015

find data in another workbook range return type mismatch error n.13

I have a problem with the following sub:

Sub prova()

Dim E As String

'Dim H As Range

'Dim G As String

E = range("D3").Value

range("F2").Select

'Set H = Worksheets("Sheet1").range("F3:F100")

range("F3:F100").find(What:=E, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate

End Sub

It returns a type mismatch error. The problem is related to the range where I want to search the variable E, either if I specify the range or I set it with a name (H). If I replace range(.....) with columns(6) or with cells (it searches in all the spreadsheet) it works. If I specify a range it doesn't work. I don't understand.

Aucun commentaire:

Enregistrer un commentaire