I have attached a screenshot as reference
1. A small example workbook with some data and the macros makes it easier for people to see
2. The way PortKeys is Dim-ed and used, I'd guess that it's an object and belonging to the Portfolios collection
In the original workbook, was there a Class module called cItems? Add that to the 64 bit version and see if it works
Public Key As String
Public sum As Double
Public Count As Long
Public Portfolios As Collection
Sub PrdTtlMV()
Dim Portfolios As Collection
Dim PortKeys as cItems
Dim PortName As String, AllMktVals As String
Dim MV As Double, counter As Long, lRow As Long
Dim LoadMeSht As Worksheet, SpacesNeeded As Variant
Set Portfolios = New Collection
Set LoadMeSht = Workbooks("load_me_test.csv").Sheets(1)
lRow = LoadMeSht.Cells(Rows.Count, "B").End(xlUp).Row
For counter = 1 To lRow
PortName = CStr(LoadMeSht.Range("B" & counter).Value)
MV = LoadMeSht.Range("G" & counter).Value
Set PortKeys = Nothing: On Error Resume Next
Set PortKeys = Portfolios(PortName): On Error GoTo 0
If PortKeys Is Nothing Then
Set PortKeys = New cItems
PortKeys.Key = PortName
Portfolios.Add PortKeys, PortName
End If
With PortKeys
.sum = .sum + MV
.Count = .Count + 1
.Portfolios.Add MV
End With
Next counter
For Each PortKeys In Portfolios
AllMktVals = AllMktVals & PortKeys.Key & SpacesNeeded & " = " & FormatCurrency(PortKeys.sum) & vbNewLine
Next PortKeys
MsgBox AllMktVals End Sub