Runtime error '13' type mismatch

ravaz

Board Regular
Joined
Mar 25, 2008
Messages
196
Why am I getting the above error on executing the code below:

VBA Code:
Sub Sett()
Dim x, i, ii, u(), dic As Object, z As String
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = vbTextCompare
x = Sheets("Settlement").Range("a1").CurrentRegion.Resize(, 25).Value
rcnt = UBound(x, 1)
ccnt = UBound(x, 2)

ReDim u(1 To 3)

For i = 12 To rcnt
If x(i, 3) Like "Order" Then
z = x(i, 4) '& ";" & x(i, 3)
    If Not dic.exists(z) Then
            u(1) = x(i, 4)
            u(2) = x(i, 18) + x(i, 19) + x(i, 20) + x(i, 21) + x(i, 22) + x(i, 23) + x(i, 24)
            u(3) = x(i, 25)
            dic.Add z, u
    Else
            u(2) = u(2) + x(i, 18) + x(i, 19) + x(i, 20) + x(i, 21) + x(i, 22) + x(i, 23) + x(i, 24)
            u(2) = u(2) + x(i, 25)
    End If
End If
Next i

Sheets("Collection").Rows("4:" & Rows.Count).ClearContents
Sheets("Collection").Cells(4, 1).Resize(dic.Count, 3).Value = Application.Transpose(Application.Transpose(dic.items))
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
The error occurs in the last row when I am trying to take the output to Sheets("Collection").
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top