IFianTHENdisplayname
New Member
- Joined
- Dec 18, 2016
- Messages
- 3
okay i just started using VBA/macros today and im pretty pleased with my progress so far
but hit a brick wall i think above my pay grade...
not looking for a bailout i'd like to understand this for the future. My job could really use these....
Data tab called "Quotation Tool":
[TABLE="width: 500"]
<tbody>[TR]
[TD]trade[/TD]
[TD]product[/TD]
[TD]date[/TD]
[TD]per[/TD]
[TD]currency[/TD]
[TD]cost[/TD]
[TD]MSR[/TD]
[TD]SSR[/TD]
[/TR]
[TR]
[TD]NW[/TD]
[TD]ocean[/TD]
[TD]dec-12[/TD]
[TD]kg[/TD]
[TD]USD[/TD]
[TD]200[/TD]
[TD]400[/TD]
[TD]450[/TD]
[/TR]
[TR]
[TD]SW[/TD]
[TD]ocean[/TD]
[TD]dec-12[/TD]
[TD]kg[/TD]
[TD]CNY[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]SW[/TD]
[TD]ocean[/TD]
[TD]de-12[/TD]
[TD]kg[/TD]
[TD]HKD[/TD]
[TD]4[/TD]
[TD]8[/TD]
[TD]9[/TD]
[/TR]
</tbody>[/TABLE]
then i have a currency conv tab called "Currencies" (refreshed web data):
[TABLE="width: 500"]
<tbody>[TR]
[TD]currency[/TD]
[TD]1USD[/TD]
[TD]inv.1USD[/TD]
[/TR]
[TR]
[TD]CNY[/TD]
[TD]6.9[/TD]
[TD]1.4[/TD]
[/TR]
[TR]
[TD]HKD[/TD]
[TD]7.1[/TD]
[TD]1.2[/TD]
[/TR]
</tbody>[/TABLE]
what i want to do: search the column for currency on data tab, find "CNY" or "HKD" or another currency. when it finds it i want to go corresponding "MSR" column cell and multiply that value by the cell in the "currencies" tab corresponding with the right currecy conversion then put result in that cell on the data tab.
I have been working on this for about 5 hours peicing together different codes from threads all over. what i have looks too basic for what i need:
I actually managed to run macros across workbooks using different lookups and replacements but this is stumping me. your thoughts are appreciated!

not looking for a bailout i'd like to understand this for the future. My job could really use these....
Data tab called "Quotation Tool":
[TABLE="width: 500"]
<tbody>[TR]
[TD]trade[/TD]
[TD]product[/TD]
[TD]date[/TD]
[TD]per[/TD]
[TD]currency[/TD]
[TD]cost[/TD]
[TD]MSR[/TD]
[TD]SSR[/TD]
[/TR]
[TR]
[TD]NW[/TD]
[TD]ocean[/TD]
[TD]dec-12[/TD]
[TD]kg[/TD]
[TD]USD[/TD]
[TD]200[/TD]
[TD]400[/TD]
[TD]450[/TD]
[/TR]
[TR]
[TD]SW[/TD]
[TD]ocean[/TD]
[TD]dec-12[/TD]
[TD]kg[/TD]
[TD]CNY[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]SW[/TD]
[TD]ocean[/TD]
[TD]de-12[/TD]
[TD]kg[/TD]
[TD]HKD[/TD]
[TD]4[/TD]
[TD]8[/TD]
[TD]9[/TD]
[/TR]
</tbody>[/TABLE]
then i have a currency conv tab called "Currencies" (refreshed web data):
[TABLE="width: 500"]
<tbody>[TR]
[TD]currency[/TD]
[TD]1USD[/TD]
[TD]inv.1USD[/TD]
[/TR]
[TR]
[TD]CNY[/TD]
[TD]6.9[/TD]
[TD]1.4[/TD]
[/TR]
[TR]
[TD]HKD[/TD]
[TD]7.1[/TD]
[TD]1.2[/TD]
[/TR]
</tbody>[/TABLE]
what i want to do: search the column for currency on data tab, find "CNY" or "HKD" or another currency. when it finds it i want to go corresponding "MSR" column cell and multiply that value by the cell in the "currencies" tab corresponding with the right currecy conversion then put result in that cell on the data tab.
I have been working on this for about 5 hours peicing together different codes from threads all over. what i have looks too basic for what i need:
Code:
Sub CurrencyConv()
'
' CurrencyConv Macro
'
'
Dim Rng As Range
On Error Resume Next
With ActiveSheet.UsedRange
Set Rng = .Range("L3:L" & .Rows(.Rows.Count).Row)
End With
If Range(Rng) = "CNY" Then
ActiveCell.Offset(0, 3).Select
End If
If Rng = "CNY" Then
ActiveCell.Formula = "=(ActiveCell.Value*Worksheets(Currencies)$C$12)"
End If
End Sub