I'd like to create an array like the following: Array[SKU][Color] will give me the code for a particular SKU in one particular color.
I'm unfamiliar with the syntax for VBA arrays though, so any examples would be helpful.
I'd like to create an array like the following: Array[SKU][Color] will give me the code for a particular SKU in one particular color.
I'm unfamiliar with the syntax for VBA arrays though, so any examples would be helpful.
You create and use Arrays like this
![]()
Please Login or Register to view this content.
If you don't need a multidimensional array, I would suggest that you don't use one. For your case, I would just use 2 arrays.
e.g.
If you still want to use a 2 dimensional array, I can show that method if you like.![]()
Please Login or Register to view this content.
Of course it would probably be better to create a sheet with the sku's in one column with the colors for the fonts or interior.color set as you like. You can then copy them as needed without using arrays.
Last edited by Kenneth Hobson; 12-22-2008 at 11:26 AM.
I'm pretty sure I'll need a multidimensional array still.
I've been looking at creating my own Type instead though.
The problem is that I'll have data such as the SKU and Color, and I'll need to return several pieces of information based on that.
It's a bit perplexing to me that you can only retrieve data from arrays using numbers, so I'll essentially be looping through an array until I find the SKU that I want, which seems like it will slow down the process a lot.
If you want to index using names rather than numerical indices then you need to look at using a collection, which has a textual key.
So how do I create a multi-dimensional collection?
The collection would not be multi dimensional. But the objects it contained can be.
You would need to create a class object that contains an array for the colours.
You would then create and populate the collection with an object for each SKU. Filling in the colours as you go.
If you need more information then provide us with more detail about sku's and colours associated with skus.
Use Match to search for a particular element in an array though iterating through the array is faster than you might think.
e.g.
One can use the Dictionary object for such things but I wind up converting the keys or items to an array and use Match for your scenario anyway.![]()
Please Login or Register to view this content.
Last edited by Kenneth Hobson; 12-22-2008 at 12:32 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks