Sub for currency converter

Peterlpv

New Member
Joined
May 12, 2014
Messages
3
SO I HAVE THREE COLUMNS THE ONE WHICH TELL ME THE CURRENCY, THE ONE THE PRICE IN THAT CURRENCY ANF FINALLY THE ONE WITH THE ASJUSTED PRICE( WHICH IS MY OUTPUT)

NOW IF THE THE CURRENCY IS "peso" the output is the same as the second row (price), if the currency is dolar. (price) must be multiplied by 13.

all this must be done in one single sub with a "for each"

[TABLE="width: 217"]
<tbody>[TR]
[TD]Currency[/TD]
[TD]Price in original currency[/TD]
[TD]Adjusted price dollar[/TD]
[/TR]
[TR]
[TD]peso[/TD]
[TD]25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]peso[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]1.5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]peso[/TD]
[TD]40[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]peso[/TD]
[TD]28[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]39[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]49[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]peso[/TD]
[TD]45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dolar[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
thanks in advance
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try this

Code:
Public Sub currency_Con()
Application.ScreenUpdating = False
Static curr, lr, lrang
'##### Define Working Range #####

lr = Sheets("sheet1").Range("a1000000").End(xlUp).Row
      
lrange = Sheets("sheet1").Range("a2:a" & lr).Address(False, False)
 
For Each curr In ActiveSheet.Range(lrange)
If curr > "" Then
        If curr.Value = "peso" Then
        
        curr.Offset(0, 2).Value = curr.Offset(0, 1).Value
        
        ElseIf curr.Value = "dolar" Then
        
        curr.Offset(0, 2).Value = curr.Offset(0, 1).Value * 13
        
        
        End If
        
Else

End If
Next curr
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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