Currency

Peterlpv

New Member
Joined
May 12, 2014
Messages
3
does anyone know hot to solve the following.

if a is true then the result is the number, if b is true (or a is false) the result is the number times 10, im supposed to use a sub, and it must be done in such a way that only executing the macro will compute the result for every #

[TABLE="width: 217"]
<colgroup><col><col span="2"></colgroup><tbody>[TR]
[TD]Condition [/TD]
[TD]#[/TD]
[TD]Result[/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]1.5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]40[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]28[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]39[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]49[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Yep.
This an assignment or homework ??
You could use a UDF or a macro with a For / Next loop
 
Upvote 0
YES ITS HOMEWORK!! hahahah

it its peso adjusted price is the same, if its dolar i multiply by 13.85
[TABLE="width: 195"]
<!--StartFragment--> <colgroup><col width="65" span="3" style="width:65pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 65"]currency of origin[/TD]
[TD="class: xl65, width: 65"]original price[/TD]
[TD="class: xl66, width: 65"]adjusted price[/TD]
[/TR]
[TR]
[TD="class: xl67"]peso[/TD]
[TD="class: xl68"] $25.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $25.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $3.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]peso[/TD]
[TD="class: xl68"] $12.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $1.50 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $3.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]peso[/TD]
[TD="class: xl68"] $40.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]peso[/TD]
[TD="class: xl68"] $28.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $19.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $39.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $5.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $20.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $49.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $3.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $3.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]peso[/TD]
[TD="class: xl68"] $45.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl67"]dolar[/TD]
[TD="class: xl68"] $4.00 [/TD]
[TD="class: xl69"] [/TD]
[/TR]
<!--EndFragment--></tbody>[/TABLE]

This is my macro and it works well, but is there a shorter way of doing it or using less the offset option?
Sub precioajustado()
Dim respuesta As String, precioajustado As Double




respuesta = InputBox("Desea Correr El Ajustador De Precios?", "BIENVENIDO")
If respuesta = "1" Then


Range("I22").Activate


For Each moneda In Range("moneda")
If moneda = "peso" Then
ActiveCell.Offset(0, -2).Select
precio = ActiveCell
ActiveCell.Offset(0, 2).Activate
ActiveCell.Value = precio
Else
ActiveCell.Offset(0, -2).Select
precio = ActiveCell
ActiveCell.Offset(0, 2).Activate
ActiveCell.Value = precio * 13.85
End If
ActiveCell.Offset(1, 0).Activate
Next


Else
MsgBox ("Programa No Ejecutado")
End If
End Sub

Thanks!!
 
Upvote 0
You don't need to activate or Select cells to work with them !
And as I don't understand (Spanish).... I think, I can't really help change it !
for example
Code:
ActiveCell.Offset(0, 2).Activate
ActiveCell.Value = precio
could be
Code:
ActiveCell.Offset(0, 2).Value = precio
 
Upvote 0

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