vba help - how to add days to Date columns

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Need your help, I want to add 15 days extra to Delivery Date. Column A is Delivery date.
Can you suggest the correct way to achieve this task. Thanks.

Below is sample data.
Book4
AB
1Delivery dateAdd 15 Days to Delivery Date
213/12/201828/12/2018
313/02/201928/02/2019
420/03/201904/04/2019
530/03/201914/04/2019
630/04/201915/05/2019
707/05/201922/05/2019
811/05/201926/05/2019
915/06/201930/06/2019
1013/07/201928/07/2019
1105/08/201920/08/2019
1214/12/201929/12/2019
1311/01/202026/01/2020
1418/01/202002/02/2020
1529/02/202015/03/2020
1619/03/202003/04/2020
1720/03/202004/04/2020
1803/04/202018/04/2020
1923/05/202007/06/2020
2030/06/202015/07/2020
2123/07/202007/08/2020
2209/09/202024/09/2020
2319/09/202004/10/2020
2423/09/202008/10/2020
2529/09/202014/10/2020
2630/09/202015/10/2020
2702/11/202017/11/2020
2805/11/202020/11/2020
2907/11/202022/11/2020
3017/11/202002/12/2020
3119/11/202004/12/2020
3220/11/202005/12/2020
3321/11/202006/12/2020
3424/11/202009/12/2020
3527/11/202012/12/2020
3628/11/202013/12/2020
3726/11/202011/12/2020
3803/12/202018/12/2020
3930/11/202015/12/2020
4001/12/202016/12/2020
4102/12/202017/12/2020
4205/12/202020/12/2020
4307/12/202022/12/2020
4408/12/202023/12/2020
4509/12/202024/12/2020
4612/12/202027/12/2020
4713/12/202028/12/2020
4810/12/202025/12/2020
4911/12/202026/12/2020
5014/12/202029/12/2020
5115/12/202030/12/2020
5217/12/202001/01/2021
5316/12/202031/12/2020
5418/12/202002/01/2021
5519/12/202003/01/2021
5621/12/202005/01/2021
5722/12/202006/01/2021
5823/12/202007/01/2021
5924/12/202008/01/2021
6026/12/202010/01/2021
6128/12/202012/01/2021
Sheet1
Cell Formulas
RangeFormula
B2:B61B2=A2+15



Thanks
Mallesh Gangadhar
 

Some videos you may like

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,794
Office Version
  1. 365
Platform
  1. Windows
Why not just use VBA to insert your formula?
 

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows
Hi Fluff,

Just for learning purpose dateadd, I am attempting below code, I am not sure which is correct way.


VBA Code:
DateExtra = 15

For i = 3 To lr_master
            wsMaster.Cells(i, Final_due_Date).value = DateAdd("d", DateExtra, wsMaster.Cells(i, Delivery_Date).value)
Next i


For i = 3 To lr_master
            wsMaster.Cells(i, Final_due_Date).value = DateAdd("d", DateExtra, format(wsMaster.Cells(i, Delivery_Date).value,"dd/mm/yyyy")
Next i


Thanks
mg
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,794
Office Version
  1. 365
Platform
  1. Windows
The 1st one should work
 

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows
Hi Fluff,

Thanks for confirmation , its working ! (y)


Thanks
mg
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,794
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,128,130
Messages
5,628,871
Members
416,347
Latest member
AT2021

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
Top