Adjust "time" column when modifying row

redkulat

New Member
Joined
Apr 8, 2018
Messages
1
Hi everyone,

Is there a forumla to automatically adjust the "time" in a column when any specific row is modified? For example:

TimeSubject
7:00 am
7:30 am
8:00 am
8:15 am
9:00 am

<tbody>
</tbody>


If I were to modify "7:00 am" by 15 minutes to "7:15 am", I would want all the other rows to automatically adjust time by 15 minute like so:

TimeSubject
7:15 am
7:45 am
8:15 am
8:30 am
9:15 am

<tbody>
</tbody>


I am hoping it's simpler than I thought. Any help guiding me in the direction would be super helpful, thank you!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Assuming your data is in Column A. In cell D2, put 0:15 and format it as date h:mm then this vba code should advance it by 15 minutes. Change Cell D2 as needed.

Code:
Option Explicit


Sub AdjTime()
    Dim i As Long, lr As Long
    Dim chg As Date
    chg = Range("D2")
    lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To lr
        Range("A" & i) = Range("A" & i) + chg
    Next i


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top