Using VBA sheet code to perform large scale currency conversion

RoneTyne

New Member
Joined
Oct 8, 2010
Messages
7
Hi All,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
Wondering if you can help. I have a workbook with 6 different worksheets each containing a report in Excel 2007. All values in the worksheets are in $USD.<o:p></o:p>
<o:p></o:p>
I would like to be able to provide functionality to the reports global users to convert the reports into other currencies, namely €EUR, £GBP, $CAD and ¥YEN. Whether this conversion happens on a per sheet level or on the coversheet and propagates through the whole workbook doesn't really matter.<o:p></o:p>
<o:p></o:p>
The thought is that I will have a hidden worksheet with all the conversion rates I wish to use (this will be static and due to company policy must be updated by me each time the report is sent out on monthly basis).<o:p></o:p>
<o:p></o:p>
When a user selects and alternative currency from either a drop down list or some sort of form control, I would like to have all the values on the worksheet (or in the workbook) converted from the $USD amount to the new currency. I would also require that the currency symbol be changed as well.<o:p></o:p>
<o:p></o:p>
I know I can create hidden columns and use formulas with vlookups to do this.<o:p></o:p>
<o:p></o:p>
But what I'm really hoping is that you all will be able to provide some guidance on how to use VBA code to perform this. Is that possible, if so, how?<o:p></o:p>
<o:p></o:p>
Any help you can provide would be greatly appreciated.<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
- RoneTyne<o:p></o:p>
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I know I can create hidden columns and use formulas with vlookups to do this.

But what I'm really hoping is that you all will be able to provide some guidance on how to use VBA code to perform this.
Surely you would simply need alternate sheets, with the conversion done with formulas, one sheet per currency. You could hide/unhide sheets for the chosen currency via VBA.
 
Upvote 0
Surely you would simply need alternate sheets, with the conversion done with formulas, one sheet per currency. You could hide/unhide sheets for the chosen currency via VBA.

Hi GlennUK,

That is another way to do it which is still better than adding a dozen or more columns per sheet. Do you know what the VBA script to hide and unhide sheets looks like? Thanks for the reply.


- RoneTyne
 
Upvote 0
To loop through all sheets you'd do something like:
Code:
For Each ws In ThisWorkbook.Worksheets

and within the loop test to see whether the sheet is to be displayed or not ( maybe you'd have a currency code in the sheetname ), like:
Code:
If Instr(1,ws.Name,"GBP") > 0 Then
   ws.Visible = True
Else
   ws.Visible = xlHidden
End If
That should give you a good starting point.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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