ho questo problema questa macro a volte genera questo errore:
"Errore di Run Time 1004 Impossibile trovare la proprietà Match x la classe WorksheetFunction"
- Codice: Seleziona tutto
Sub Spiare()
Dim ws1 As Worksheet, Rng As Range, c As Object
Set ws1 = Worksheets("Inserimento")
Worksheets("Spia Generale").Select
'NOTA: qui cancello i risultati precedenti. Se non lo deve fare commenta la seguente riga:
Worksheets("Spia Generale").Range("B2:AK37").ClearContents
For r = 2 To 37
n = Cells(r, 1)
With ws1.Range("A2:A" & Rows.Count)
Set c = .Find(n, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
r1 = c.Row + 1
For i = 1 To 5
n1 = ws1.Cells(r1, 1)
If n1 <> "" Then
lcol = Application.WorksheetFunction.Match(n1, Range("1:1"), 0)
Cells(r, lcol) = Cells(r, lcol) + 1
r1 = r1 + 1
End If
Next i
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress 'And c.Value = n
End If
End With
Next r
End Sub