Summerizig data

rize1159

Board Regular
Joined
Jan 8, 2011
Messages
51
I have code like this


Sub MG18Sep51
Dim Rng As Range, Dn As Range
Dim oTri As String, Q
Dim Mth As Date
Set Rng = Range(Range("E2"), Range("E" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
oTri = Dn & Dn(, 2) & Dn(, 4)
If Not .Exists(oTri) Then
.Add oTri, Array(Dn, Dn(, 2), MonthName(Month(Dn(, 3))), Dn(, 4), Dn(, 5))
Else
Q = .Item(oTri)
Q(4) = Q(4) + Dn(, 5).Value
.Item(oTri) = Q
End If
Next
Range("K2").Resize(.Count, 5) = Application.Transpose(Application.Transpose(.Items))
End With
End Sub



but this is giving type mismatch error with me can anyone tell me the reason
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
When I test your code, this line pops the error that you mentioned...

Code:
Range("K2").Resize(.Count, 5) = Application.Transpose(Application.Transpose(.Items))
I've not worked with the dictionary object before, so I'm just guessing here, but it looks like the .Items property is a one-dimensional array and you are trying to assign to a two-dimensional range.
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,233
Members
452,898
Latest member
Capolavoro009

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