Thread: User Forms
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Matthew Balch[_2_] Matthew Balch[_2_] is offline
external usenet poster
 
Posts: 46
Default User Forms

I have copied this VB from another answer to a similar problem I have. This
being part of it:-
------------------------------------
Private Sub LoadMarkets()
Dim markets As New Scripting.Dictionary
Dim index As Long
Dim market As String
For index = 2 To Source.Rows.Count
market = Source.Cells(index, 1)
If Not markets.Exists(market) Then
markets.Add market, market
cmbMarket.AddItem market
End If
Next


End Sub
--------------------------------

Obviously the spreadsheet works fine when I download it. But when I try to
recreate the code into a different workbook it doesnt work.

The problem being the second line of code. Dim markets As New.Scripting
Dictionary. Problem being 'Used-defined type not defined'.

Can someone please help me with this? Why it works in existing spreadsheet
but then why if copied to a new workbook no longer works?

Thanks
Matthew