A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello Francisco
Firstly Thank you
(overwriting 10-February with 24-February), in Cell J2
Just on Cell J2
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello from Steve
Please how do I write a Macro that would add 14 days
for example In Cell J2 I have10-February add 14 days to become 24-February
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello Francisco
Firstly Thank you
(overwriting 10-February with 24-February), in Cell J2
Just on Cell J2
Hello,
I need to clarify how you want the result to be handled to ensure this fits your workflow.
J2 to be permanently replaced by the calculated date (overwriting 10-February with 24-February), or do you simply want to see the new date in a different cell next to it?J2?
To write a Macro in Excel that adds 14 days to a specified date, you can use the DateAdd function in VBA (Visual Basic for Applications). Here’s a simple example of how you can achieve this:
Sub AddDays()
Dim FirstDate As Date ' Declare variable for the initial date
Dim NewDate As Date ' Declare variable for the new date
FirstDate = InputBox("Enter a date (e.g., 10-February)")
NewDate = DateAdd("d", 14, FirstDate) ' Add 14 days to the first date
MsgBox "New date: " & NewDate ' Display the new date
End Sub
In this script:
DateAdd function is used to add 14 days to the entered date.Make sure to run this Macro in the VBA editor within Excel to see the results.