VBA – HH:MM:SS from Minutes – Format in Access(Excel)

Today I was building some Access DB, where I had to sum two variables in HH:MM:SS format. Then I had to multiply them by one integer and at the end to display them as HH:MM:SS once again.

minutes

It seems really easy, if you are programmer who uses plenty of external libraries, but with VBA you need some time to make sure it runs smoothly. Actually, the reason I write this article (as plenty of the articles in this blog) is simply to have it available for me. Not that I do not have a GitHub profile, but this way is fancier.

So, this is how the VBA code looks like:

So pretty much, if you have as input datFirst = 00:02:00 and datSecond = 00:05:00 and Multiplier = 3  at the end of our test we would have 00:21:00 printed in the console. It is useful and as easy as it seems  🙂

Enjoy it !

 

About

VBA Developer

Tagged with: ,