Search code examples
vb.netexceluser-defined-functionsexcel-dna

UDF Methods For Determining Currency or Double


I'm creating a UDF in VB.NET that sometimes works with currency, which I would need to use the Decimal format in VB. But sometimes I working with time or just a plain double. What methods are out their for determining how I should add the values up, with a decimal or double?

I prefer not to have excel return the actual range for simplicity sake but will do if I need to determine if it is formatted as currency.


Solution

  • Since Excel uses Doubles for currency, time values, integers and all other numbers its not usually neccessary to find out how the number is formatted for Excel display purposes: just add the values up.= as doubles.