2003 / 2010 Macro Compatability (Edate)

malderon

New Member
Joined
Oct 17, 2011
Messages
1
Hi all,

I have tried to search around for this so please forgive me if this is an issue previously covered.

At work we use Excel 2003, wheras at home I have Excel 2010. I'm having some problem using work spreadsheets at home, specifically running macros with Edate and Yearfrac in.

I think this is something to do with the fact that these functions have been moved from the analysis toolpak in 2003, (thus ticking the atpvbaen reference meant they could just be called directly as EDATE() or YEARFRAC() to built in Excel functions which means they must be called as Application.WorksheetFunction.Edate(). This may be incorrect but this is my understanding based on the fact I get Sub or Function undefined with the original code.

Is there any way to get around this without changing the code, some sort of compatability mode or something, because I don't want to have to change all the code only to have to change it all back again when I send the sheet to people at the office.



Many thanks in anticipation of your help.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
You could add a version check to your code:
Code:
If Val(application.version) < 12 then
 ' 2003 code here
Else
 ' 2007 or later code here
End If
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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