Here is a sample code. when i passed the "firstdict" to my second sub, and added another element to "mydict". i want the element to be added in the second sub only to "mydict" not "firstdict". but the element is actually added to both of them. how to fix it?
thanks
Sub dict()
Dim firstdict As New Scripting.Dictionary
firstdict.Add "1/1/1981", 44
firstdict.Add "1/2/1981", 22
changedict firstdict
End Sub
Sub changedict(ByVal firstdict As Scripting.Dictionary)
Dim mydict As Scripting.Dictionary
Set mydict = firstdict
mydict.Add "1/3/1982", 11
'then want to play with mydict, leave "firstdict" no change
End Sub
thanks
Sub dict()
Dim firstdict As New Scripting.Dictionary
firstdict.Add "1/1/1981", 44
firstdict.Add "1/2/1981", 22
changedict firstdict
End Sub
Sub changedict(ByVal firstdict As Scripting.Dictionary)
Dim mydict As Scripting.Dictionary
Set mydict = firstdict
mydict.Add "1/3/1982", 11
'then want to play with mydict, leave "firstdict" no change
End Sub