Can you create a double linked list datatype in Excel 2000-2003 VBA

PegasusJF

New Member
Joined
Dec 7, 2007
Messages
26
I just completed my first program in VBA for my work. (I've given up on using Excel's built in functions)

The gist is that it averages total production and waste for a month based on a product type and shift and then spits out the averages in a chart friendly format. The product type and shift and even the starting cell for the data print is done via user prompt boxes

It beat my head in for a couple days but I finally put up enough coding band-aids to at least work for the data I put into it.

But I'm thinking to the next version, something that will just read the entire workbook and organized the data into a data structure that allows for new types and it freely extendable.

Arrays, well, I suppose they would work but I'm not fond of the fixed sizes nor the fact that you can't use variable values to initialize their sizes in VBA.

What I'm thinking is a 2 dimension double linked list. I think it would be perfect, it would only be as big as it has to be and is freely extensible and will take in any previously unencountered product type and start gathering data on that.

Is there any way to create this data type using VBA's abilities in that area?
 

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
You want to simply do that in C, which is where you've ever used any linked list before, or even heard of the concept being used with, right?

Visual C interfaces directly with the Excel application. But if you're merely using Excel to columnarize, font/format, arrange page breaks, and such ... then you probably only need Word instead of Excel.

I've written 7 million pointers in my life in C and .ASM. Before I die, I plan to write another zero in VBA. I don't see any future in that route...
 
Upvote 0
GIA, C++ to be exact. I leaned them in while I was taking computer science courses. I could just set up an 2D array that has a excess amount of cells but the purist programmer in me wants to be more elegant. A double linked list would be more elegant.

Thanks for your reply.

Richard, thanks for the link! I'll look it over. Hopefully it won't be too complicated.
 
Upvote 0
Well, now that my obligatory "steer-you-away" post is done (but I won't be the last to dissuade you), I applaud your intent. I still have to point out that it is an unusual route, because Excel inherently manages cell ranges for you as you insert and delete interior elements.
Here are a few places that may aid your inspired quest:

Books: http://www.mrexcel.com/sunshop/ (partial list; see its left side links)

http://www.xlpert.com/
Succinct yet potent Excel VBA primer
http://www.xlpert.com/part_D.htm
Note this chapter in particular, dealing with data storage in VBA. It only brushes with user-defined Types, which should be your ultimate focus for this task. Look in VBA help for "Type Statement"

http://www.erlandsendata.no/english/index.php?t=envbadac
Coding data transfer between applications.

http://www.cpearson.com/excel/ExcelPages.aspx
"Advanced techniques made simple" would be a good title for this. Chip's site is well known for great code and sheet techniques, and often he's the only place they're documented at all. You'll have no problem immersing yourself for a month here and at http://j-walk.com/ss/index.htm.

http://www.mvps.org/dmcritchie/excel/excel.htm
David McRitchie's Excel pages - maybe the most extensive source of every type of Excel detail I've ever seen outside of Redmond.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,809
Members
449,048
Latest member
greyangel23

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