Add Range to Dictionary

30percent

Board Regular
Joined
May 5, 2011
Messages
123
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:

[TABLE="width: 128"]
<tbody>[TR]
[TD="class: xl63, width: 64"]Product[/TD]
[TD="class: xl63, width: 64"]Order[/TD]
[/TR]
[TR]
[TD="class: xl64"]Chair[/TD]
[TD="class: xl64"]10[/TD]
[/TR]
[TR]
[TD="class: xl64"]Table[/TD]
[TD="class: xl64"]5[/TD]
[/TR]
[TR]
[TD="class: xl64"]Pencil[/TD]
[TD="class: xl64"]20[/TD]
[/TR]
[TR]
[TD="class: xl64"]Pen[/TD]
[TD="class: xl64"]30[/TD]
[/TR]
[TR]
[TD="class: xl64"]Printer[/TD]
[TD="class: xl64"]1[/TD]
[/TR]
[TR]
[TD="class: xl64"]Phone[/TD]
[TD="class: xl64"]5[/TD]
[/TR]
</tbody>[/TABLE]

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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
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,226,120
Messages
6,189,082
Members
453,524
Latest member
AshJames

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