Macro function which finds and replaces cells

cpisthedbb

New Member
Joined
Apr 10, 2018
Messages
30
Hi,

I've been trying for a while to do this but my knowledge on macros is limited so would appreciate any help.

I'm copying from a database into Excel process times. With some of the process times there has been an adjustment so the original time needs altering. For example the 1st 2 lines need amending so the end time for Daniels is 06/12/18 06:30 altering his duration. The adjustments can sometimes be before the one that needs altering or after which is why I'm struggling to compile a macro which does the following:

- If there is a minus adjustment, this needs deductiong from the original time to show the correct duration.
- Once this has been done the minus line needs deleting
- any until time which has been amended needs then turning green to show the adjustment.

The second post is what I was after the spreadsheet looking like.

(I hope all this makes sense and hope there's a way of doing it)



Original Spreadsheet:

A B C D E F

User IDNameFromUntilCapacity [%]Duration [h]
2021Daniels06/12/2018 04:1506/12/2018 06:5602:41:05
2021Daniels06/12/2018 06:3006/12/2018 06:56-100:26:13
3007Rhodes05/12/2018 04:2405/12/2018 07:1702:52:56
3007Rhodes05/12/2018 06:0005/12/2018 07:17-101:17:04
3007Rhodes07/12/2018 18:0307/12/2018 21:0703:04:00
3011Slack05/12/2018 02:1605/12/2018 03:0100:44:47
3011Slack05/12/2018 04:2805/12/2018 07:1802:49:04
3011Slack05/12/2018 05:5905/12/2018 07:18-101:19:02
3011Slack07/12/2018 18:0207/12/2018 18:0800:05:35
3013Jagger07/12/2018 15:3107/12/2018 17:5402:23:01
3014Bowes03/12/2018 03:2903/12/2018 06:5303:23:36
3014Bowes03/12/2018 06:0003/12/2018 06:53-100:53:22
3014Bowes05/12/2018 18:0205/12/2018 19:4201:39:30
3014Bowes07/12/2018 03:3507/12/2018 06:4303:08:15
3014Bowes07/12/2018 06:0007/12/2018 06:43-100:43:16
3015Selways04/12/2018 06:4304/12/2018 07:3400:50:26
3015Selways04/12/2018 07:3404/12/2018 09:4602:11:56
3016Holborn09/12/2018 00:4109/12/2018 02:5602:14:54
3016Holborn09/12/2018 03:2109/12/2018 07:0303:41:57
3016Holborn09/12/2018 06:0009/12/2018 07:03-101:03:25
3019Lovells09/12/2018 00:4209/12/2018 02:5702:15:09
3019Lovells09/12/2018 06:0009/12/2018 07:01-101:01:17
3019Lovells09/12/2018 03:2009/12/2018 07:0103:40:46

<colgroup><col><col><col span="2"><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
User IDNameFromUntilCapacity [%]Duration [h]
2021Daniels06/12/2018 04:1506/12/2018 06:3002:14:52
3007Rhodes05/12/2018 04:2405/12/2018 06:0001:35:51
3007Rhodes07/12/2018 18:0307/12/2018 21:0703:04:00
3011Slack05/12/2018 02:1605/12/2018 03:0100:44:47
3011Slack05/12/2018 04:2805/12/2018 05:5901:30:02
3011Slack07/12/2018 18:0207/12/2018 18:0800:05:35
3013Jagger07/12/2018 15:3107/12/2018 17:5402:23:01
3014Bowes03/12/2018 03:2903/12/2018 06:0002:30:13
3014Bowes05/12/2018 18:0205/12/2018 19:4201:39:30
3014Bowes07/12/2018 03:3507/12/2018 06:0002:24:58
3015Selways04/12/2018 06:4304/12/2018 07:3400:50:26
3015Selways04/12/2018 07:3404/12/2018 09:4602:11:56
3016Holborn09/12/2018 00:4109/12/2018 02:5602:14:54
3016Holborn09/12/2018 03:2109/12/2018 06:0002:38:32
3019Lovells09/12/2018 00:4209/12/2018 02:5702:15:09
3019Lovells09/12/2018 03:2009/12/2018 06:0002:39:29

<colgroup><col><col span="3"><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,651
Members
449,111
Latest member
ghennedy

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