Convert a cell or multiple cells from SGD value to USD value based on relevant monthly exchange rate

ameenuksg

Board Regular
Joined
Jul 11, 2017
Messages
83
Hi I want to create a VBA to convert 1 or multiple cells in Sheet 1 to the appropriate value by selecting them in column A and applying the relevant monthly exchange rate from Sheet 2.

Would greatly appreciate any help:)

Sheet 1Sheet 1Sheet 2Sheet 2
ABAB
Net Sales - $Sales DateFeb 20200.7543
2003 Mar 2020Mar 20200.7489
3004 Apr 2020Apr 20200.7123
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Just want to improve the code to only convert rows of cells that are visible on the sheet after filtering a column or columns as the current code changes rows that were hidden or filtered too
 
Upvote 0
Hey ameenuksg,

Try to replace the 2 in the below line with 12

Rich (BB code):
For Each c In Rg.SpecialCells(2) '<--- Change it to 12

Just to give an explatation of the difference, the SpecialCells is very useful & could also be used without VBA in normal excel which can be accessed by either pressing F5 or Ctrl+G then clicking Special. In the code, the 2 refers to xlCellTypeConstants where I changed it now to 12 which refers to xlCellTypeVisible as you can see in the below picture. I encourage you to click HERE to understand more about it (y)

Capture.PNG
 
Upvote 0
Hi again, I see that the macro would not work on cells with values resulted from a formula. Can we tweak the vba to also convert cells with formula ??
 
Upvote 0
Hi ameenuksg,

Did you change the number from 2 to 12 as per my post #23 ? Because if you did, it should consider all selected visible cells even if the cell value is a result of a formula
Rich (BB code):
For Each c In Rg.SpecialCells(2) '<--- Change it to 12
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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