Hi. I keep getting this error whatever I do in the workbook, Excel points to the "if not intersect" line. Can anyone help me?
HTML:
Private Sub Worksheet_Calculate()
Dim Target As Range, rng As Range, c As Range, myMatch As Variant
If Not Intersect(Target, Range("TabellaContratti[Indirizzo]")) Is Nothing Then
Set rng = Intersect(Target, Range("TabellaContratti[Indirizzo]"))
Else Exit Sub
For Each c In rng
If Len(c.Value) = 0 Then
c.Offset(0, 1).Value = ""
Else
myMatch = Application.Match(Split(c.Value, " ")(UBound(Split(c.Value))), Worksheets("#SigleProvince").Range("TabellaProvince[Sigla]"), 0)
If Not IsError(myMatch) Then
c.Offset(0, 1).Value = Application.Index(Worksheets("#SigleProvince").Range("TabellaProvince[Provincia]"), myMatch)
End If
End If
Next
End If
End Sub
Last edited: