I am using MS Excel together with VBA (Visual Basic for applications) to write macros to calculate Molad Tishrei.
I have located information in various web sites that explain how to calculate Molad Toshrei for 1 year if I know the Molad of the previous year. However, I cannot use a fixed calculation for determining the Molad of a random year, since I don't know how many leap years occurred since that random year, and the result comes out incorrectly.
I found some web articles that explain the overall concepts, but I need a step by step algorithm or math formula that works. I.e. - if I know when Molad Toshrei for 5774 was, and I want to find out Molad Tishrei for 5790, how do I do that?
Ideally, if someone has written VB code or done this in Excel, that would be great. However, even if I have a "simplified" stepwise English-explained algorithm, that would work as well.
You don't have to answer with code, of course. A link would be fine. If you have tested the code yourself and verified that it works, even better!