Align Secondary Axis in VBA, C#, and VB.NET

Recently, I was asked to align two axes in a particular chart as part of a process that generated 100+ files, each with a chart of this type, ran regularly. The code was prototyped in VBA, but I am also working with a team that will need to replicate the process in server-side .NET, so converted the code to a C# class, and then ran it through Telerik's code convertor to get VB.

The general algorithm used for aligning a chart's secondary axis with the primary axis:
  1. Get primary and secondary divisors
  2. Get upper and lower bounds of secondary axis
  3. Get larger of the larger absolute value of the secondary axis
  4. Multiply (max/min) divisor by each of an array of numbers to find the first multiplier larger than absolute maximum
  5. Apply multiplier to major unit
  6. Apply min and max (multiplier x divisors)
The three versions are here:

Saying "No" to Learning...

The time I was most annoyed at someone for pushing learning a new language, it was [defunct technology]. A new developer in the group was pushing a C++/C# guy to learn [defunct technology], while the executive director agreed with me to just to let him create whatever-it-was in C#. The reasons I objected: As for myself, I gladly learn technologies that I think would be useful, or might advance my career, or that I find intellectually engaging, although it is usually not learning a new language, but more likely an new architecture. My background is in MS Office, desktop, and database development, with light but varied work in web UI's. I was recently expected to pick up more ASP.NET MVC, which is not a radical departure from my own MVP/MVVM desktop designs, as well as things like Entity Framework. The work is fun enough, my productivity increased, they are marketable skills, and they are natural extensions of what I currently work with, although I would gladly learn pick up some newer technologies given the opportunity:

New Code: Threaded SQL Execution (C# + Facade for VBA)

A C# library that simplifies some aspects of connecting to Db's and running SQL statements in a threaded manner. The C# code can also exposed to Excel VBA, enabling it to simultaneously execute numerous SQL statements, something that cannot normally be done in VBA.
read all...