Errore di run-time' - 2147417848 (80010108)
Metodo 'Value' dell'oggetto Range non riuscito
l'istruzione dove si blocca è un banale
Range("A1").Value = "" ossia scrivi niente nella casella
ho provato anche a sostituirlo con un Range("A1").clear
è una private sub che inserisco qui sotto
- Codice: Seleziona tutto
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Application.EnableEvents = False
If Range("A1").Value <> "" Then
Range("G2:V10000").Clear
For EU = 1 To nfg ' nfg è una variabile pubblica
If Sheets(EU).Name = "Home" Then Exit For
With Worksheets(Sheets(EU).Name)
col = 11 ' Colonna K
For i = 1 To .Cells(Rows.Count, "L").End(xlUp).Row
myh = .Cells(i, 11).Value
If Now - CDate(myh) > 0.25 Then Exit For ' se è maggiore di 6h allora esci
myHero = .Cells(i, 12).Value
myExH = Application.Match(myHero, Range("H:H"), 0)
If myHero = "" Then Exit For ' se è finita la lista esci
If IsError(myExH) Then ' se non c'è nella lista lo inserisce
Cells(Cells(Rows.Count, "H").End(xlUp).Offset(1, 0).Row, "H").Value = myHero
Cells(Cells(Rows.Count, "H").End(xlUp).Offset(0, 0).Row, "G").Value = myh
End If
For inlin = 2 To Cells(Rows.Count, "H").End(xlUp).Row
For diff = 14 To 1 Step -1
If Range("G1").Value - CDate(Cells(inlin, 7).Value) < Cells(1, diff + 8).Value Then
Cells(inlin, diff + 8) = "X"
End If
Next diff
Next inlin
Next i
End With
Next
End If
Application.EnableEvents = True
Range("A1").Clear
End Sub