Hi all,
I'm building a spreadsheet to help deal with an issue at work around train stock. Unfortunately, we don't stop running trains at midnight, and many of these instances mean i'm dealing with times that bridge midnight.
I have come up with a solution to this (which has effectively moved midnight to 03:00), however my VBA code that fixes the errors this applies is a series of copies and pastes. I would like to have a formula that reads down the time column, and where the time is less than 03:00, it adds 1 to the time (i.e.: moving it to the next day so that it considers 03:00 the end of the day rather early in the day).
Basically I have columns in a table named ONATime (D9:D109) and RESTime (G9:G109)
I then have a separate column that applies the formula =if(or($D9=0,$d9=""),"",if($D9=<0.125, $D9+1, $D9))
That column is then copied and pasted by the Macro as values
That NEW column is then copied and pasted over the original D9:D109 column to exclude blank values
What I would like instead is a macro that simply applied that formula to columns D9:109 + G9:G109 and replaced any data in that column with the results of the formula, excluding blanks
Is there a way to do this? I mean right now it works, but it just seems inelegant and it could be done more cleanly.
Thanks,
Tom
I'm building a spreadsheet to help deal with an issue at work around train stock. Unfortunately, we don't stop running trains at midnight, and many of these instances mean i'm dealing with times that bridge midnight.
I have come up with a solution to this (which has effectively moved midnight to 03:00), however my VBA code that fixes the errors this applies is a series of copies and pastes. I would like to have a formula that reads down the time column, and where the time is less than 03:00, it adds 1 to the time (i.e.: moving it to the next day so that it considers 03:00 the end of the day rather early in the day).
Basically I have columns in a table named ONATime (D9:D109) and RESTime (G9:G109)
I then have a separate column that applies the formula =if(or($D9=0,$d9=""),"",if($D9=<0.125, $D9+1, $D9))
That column is then copied and pasted by the Macro as values
That NEW column is then copied and pasted over the original D9:D109 column to exclude blank values
What I would like instead is a macro that simply applied that formula to columns D9:109 + G9:G109 and replaced any data in that column with the results of the formula, excluding blanks
Is there a way to do this? I mean right now it works, but it just seems inelegant and it could be done more cleanly.
Thanks,
Tom