Convert edate formual to VBA

smithke29

New Member
Joined
Jul 21, 2016
Messages
2
I have the following formula in a cell: =EDATE(B5,ROUNDUP((((YEAR(C7)-YEAR(B5))*12+(MONTH(C7)-MONTH(B5)+1))/2),0))))

I want to convert this to VBA but I can't figure out exactly how to write this. Any assistance that can be provided is appreciated. I'm using MS Excel 2010
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I have the following formula in a cell: =EDATE(B5,ROUNDUP((((YEAR(C7)-YEAR(B5))*12+(MONTH(C7)-MONTH(B5)+1))/2),0))))

I want to convert this to VBA but I can't figure out exactly how to write this. Any assistance that can be provided is appreciated. I'm using MS Excel 2010
If this is a single formula reference, you can just evaluate the formula directly within VBA. Here I am assuming you are assigning the calculated value to a variable named Diff...
Code:
[table="width: 500"]
[tr]
	[td]Diff = Evaluate("EDATE(B5,ROUNDUP((((YEAR(C7)-YEAR(B5))*12+(MONTH(C7)-MONTH(B5)+1))/2),0))")[/td]
[/tr]
[/table]
If it is not a single cell reference, then you need to tell us about your layout and where the result is to go to.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,919
Messages
6,175,368
Members
452,638
Latest member
Oluwabukunmi

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