2014-10-15, 02:03 #1
- Join Date
- Oct 2014
- Thanked 0 Times in 0 Posts
Macro to convert figures in USD to a different currency
I have a Word document that contains a huge amount of figures in US dollars that I would like to convert to a different currency. I am trying to figure out if it would be possible to write a macro that finds all these numbers and multiplies them by a user-defined constant? I'm somewhat lacking in the VB programming department but does anyone here know if this is even possible? I'm thinking the biggest challenge is to correctly identify each figure, i.e. "123,456.78" should not be identified as three separate numbers etc. Does anyone have any ideas?
Any help would be greatly appreciated!
Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!
+ Get this BONUS — free!
Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!
2014-10-16, 01:48 #2
- Join Date
- May 2002
- Canberra, Australian Capital Territory, Australia
- Thanked 188 Times in 172 Posts
Doing a currency conversion is a trivial exercise. Amounts containing ',' for a thousands separator and '.' for a decimal separator are understood in VBA as a single number. All you really need to know is how to identify where the amounts are (you probably wouldn't want to convert dates & times, for example) and what the conversion rates are. Indeed, if the data are all in a table and you want to retain the original, the conversion rate and the result, you don't even need VBA - it can all be done with field coding.Cheers,
[MS MVP - Word]