Add Range to Dictionary

30percent

Board Regular
Joined
May 5, 2011
Messages
122
Office Version
  1. 2016
Platform
  1. Windows
Hi,

how do I add a range to dictionary using VBA? As an example shown below, using Product as key and Order as value:

ProductOrder
Chair10
Table5
Pencil20
Pen30
Printer1
Phone5

<tbody>
</tbody>

Thank you!
 
Hi Rick, what is the best way to lookup values in vba (as an alternative to xlookup in excel)..

Is it possible to use arrays as an alternatibe to vlookup/xlookup?
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
To look up values in an array, you would run a loop. Because the array is in memory, looping will occur quite quickly.

No, Excel formulas do not have direct access to VBA arrays. You could give formulas access via a UDF (user defined function) but once you are working in VBA, my recommendation is to continue working in VBA and output your results from there (that should be more efficient overall).
 
Upvote 0

Forum statistics

Threads
1,216,591
Messages
6,131,629
Members
449,658
Latest member
JasonEncon

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