Link to home
Start Free TrialLog in
Avatar of tmonteit
tmonteitFlag for Afghanistan

asked on

Excel VBA Question

Is there anything like a Java HashMap in Excel VBA?

I'm looking for a quick way to store and index values based on a string.
ASKER CERTIFIED SOLUTION
Avatar of leonstryker
leonstryker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Patrick Matthews
Depending on what you're doing, a Collection might work too...
Avatar of tmonteit

ASKER

Problem with the Dictionary Object.  

I get an error.  "Compile Time error.  USer defined type not defined. "

Alt-F11 from MS Excel

Sub myFunction
  Dim dict as Dictionary

end Sub

When I read the instructions in the tutorial, it tell me:  'Add the dictionary object references by opening the project references from the Project menu and adding the Microsoft Scripting Runtime. The following diagram should help you out with this."

The Alt-F11 VB Editor doesn't have a project menu.

What's my next step?
tmonteit,

To add a reference in VBA:

Go to Tools|References from the menu.  Select the libraries you need references for.

Regards,

Patrick
In Excel VBA, Under the "Tools" menu,  the "References" item is greyed out.   Grrrrrr!!!  Frustrating.

  What's causing this?  I would like to try the dictionary object it sounds exactly like what i need.

-t
t,

Make sure you are not in break mode.  Select Run|Reset from the menu, and then try the references again.
> In Excel VBA, Under the "Tools" menu,  the "References" item is greyed out.

You also need to have a worksheet open and at least one module added to it.

Leon
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In the past I found that if you have Excel open, and absolutly no Workbooks or XLA loaded, you could not establish a reference. Opening a module, which is also imposible without an opened workbook, is a simple way to insure that this does not happen.

Leon
Leon,

Well yes, if no workbook nor add-in is open, then of course you cannot add a reference--
nothing to add it to.

:)

Patrick
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial