Hi all, i have the below code, which i was working for many years, but it block in a sheet on the point with blue letters.
I would much appreciated if you could help me so that to run the code. The message which appears is follow:
Run-time error '13':
Type mismatch
Thanks in advance
Dim Rng As Range, Dn As Range, N As Long, nRng As Range
Set Rng = Range(Range("B1"), Range("B" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If Not .exists(Dn.Value) Then
.Add Dn.Value, Dn
Else
.Item(Dn.Value).Offset(, 1).Value = _
.Item(Dn.Value).Offset(, 1).Value + Dn.Offset(, 1)
.Item(Dn.Value).Offset(, 2).Value = _
.Item(Dn.Value).Offset(, 2).Value + Dn.Offset(, 2)
If nRng Is Nothing Then Set nRng = Dn Else Set nRng = Union(nRng, Dn)
End If
Next
If Not nRng Is Nothing Then nRng.EntireRow.Delete
End With
I would much appreciated if you could help me so that to run the code. The message which appears is follow:
Run-time error '13':
Type mismatch
Thanks in advance
Dim Rng As Range, Dn As Range, N As Long, nRng As Range
Set Rng = Range(Range("B1"), Range("B" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If Not .exists(Dn.Value) Then
.Add Dn.Value, Dn
Else
.Item(Dn.Value).Offset(, 1).Value = _
.Item(Dn.Value).Offset(, 1).Value + Dn.Offset(, 1)
.Item(Dn.Value).Offset(, 2).Value = _
.Item(Dn.Value).Offset(, 2).Value + Dn.Offset(, 2)
If nRng Is Nothing Then Set nRng = Dn Else Set nRng = Union(nRng, Dn)
End If
Next
If Not nRng Is Nothing Then nRng.EntireRow.Delete
End With