PDA

View Full Version : macro to add or subtract date and time from yyyymmdd_hhmmss format



rf78801
01-14-2023, 08:34 PM
Might anyone already have a VBA macro to add or subtract time and date from a string in yyyymmdd_hhmmss (e.g. 20230102_233411) format? The subtracting is giving me fits :)

Thanks!

arnelgp
01-14-2023, 10:22 PM
if the Cell is Formatted as such, you can easily carry out the subtraction/addition.
but if they are String values, you need to convert them first to Real date/time then you can do the addition/subtraction.