Solved

Updating Currency

Posted on 2013-11-26
14
167 Views
Last Modified: 2013-11-27
EE Pros,

Macroshadow worked with me on a Currency Conversion Program that I need to redo.  Attached is a WB with 3 WSs.  I'm looking for a macro that will appear on the first WS and update the MSN Currency chart (WS - Currency) and then place the correct Currency that is selected into two cells located on the other two WSs.

That's it!

Thank you in advance.

b.
Macros-and-formulas-to-support-C.xlsm
0
Comment
Question by:Bright01
  • 7
  • 7
14 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39679827
Insert a button and assign a macro to it and insert this in the macro to update the table

Sheets("Currency").QueryTables(1).Refresh

Correcting G4, G5 to
''Customer-Inputs'!C9
''Price Quote'!F20

and inserting these formulas in  I4, I5
=INDIRECT(G4)
=INDIRECT(G5)

will pick values from the other sheets

Using this formula in I4, I5
will give the values in the selected currency
=INDIRECT(G4)*INDEX(J4:R4,0,MATCH('Customer-Inputs'!$F$2,Currency!$J$3:$R$3))/H4
=INDIRECT(G5)*INDEX(J5:R5,0,MATCH('Customer-Inputs'!$F$2,Currency!$J$3:$R$3))/H5
0
 

Author Comment

by:Bright01
ID: 39680492
The Update Table works!  The provisioning of the value selected doesn't work yet.  Take a look.....

B.
Currency-Update-and-Display.xlsm
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39680516
Delete one of the apostrophes from each of G4 and G5. You will be left with two each. One hidden and one displayed.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Bright01
ID: 39680598
Now I'm getting a -0- instead of the selected currency.  Take a look.
Currency-Update-and-Display.xlsm
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39680626
That formula was supposed to pick up values from the yellow cells on the other two sheets which are presently empty. If you want the values picked from the pound column then change those formulas to

=INDEX(J4:R4,0,MATCH('Customer-Inputs'!$F$2,Currency!$J$3:$R$3))
=INDEX(J5:R5,0,MATCH('Customer-Inputs'!$F$2,Currency!$J$3:$R$3))

And also make sure that the spelling in Customer!F2 "exactly" maches one of the column headers on Currency sheet.
0
 

Author Comment

by:Bright01
ID: 39680697
OK... I got it.  Now I see what is the problem.  The right formula for the Currency Value is:


=INDEX(J4:R4,0,MATCH('Customer-Inputs'!$F$2,Currency!$J$3:$R$3))

BUT;

What is suppose to happen is once the formula provides the value (above), then the macro should place this value into the Cell that is Cell Referenced (in column G).  That's the part that's missing.  I should have been more clear on what I was looking for.

Thank you,

B.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39680876
Ok try this

Sub CurrencyUpdate()
Sheets("Currency").QueryTables(1).Refresh
With Sheets("Currency").Range("G4")
    Sheets(Replace(Split(.Value, "!")(0), "'", "")).Range(Split(.Value, "!")(1)).Value = .Offset(, 2).Value
End With
With Sheets("Currency").Range("G5")
    Sheets(Replace(Split(.Value, "!")(0), "'", "")).Range(Split(.Value, "!")(1)).Value = .Offset(, 2).Value
End With
End Sub
0
 

Author Comment

by:Bright01
ID: 39681017
Perfect!  Works well.  Only one last question; as I scale this, I'm going to have to put in multiple lines of this...... ( I have 50 lines!).

With Sheets("Currency").Range("G4")
    Sheets(Replace(Split(.Value, "!")(0), "'", "")).Range(Split(.Value, "!")(1)).Value = .Offset(, 2).Value
End With
With Sheets("Currency").Range("G5")
    Sheets(Replace(Split(.Value, "!")(0), "'", "")).Range(Split(.Value, "!")(1)).Value = .Offset(, 2).Value

Is there a way to reference the range without replicating the lines over and over?

B.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39681154
Try this. I have not tested it.

For Each cel In Sheets("Currency").Range("G4:G5")
    Sheets(Replace(Split(cel.Value, "!")(0), "'", "")).Range(Split(cel.Value, "!")(1)).Value = cel.Offset(, 2).Value
Next cel
0
 

Author Comment

by:Bright01
ID: 39681280
I get an error that "cel" is not defined.

B.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39681512
Then define it as a range
0
 

Author Comment

by:Bright01
ID: 39681571
So simply define "cel" as a Range Name?  I'm confused....sorry.  Do I simply list the range as G:G so it will accommodate all of the additional lines?

B.
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39681606
dim cel as range
For Each cel In Sheets("Currency").Range("G4:G10000")
if cel.value <> "" then
    Sheets(Replace(Split(cel.Value, "!")(0), "'", "")).Range(Split(cel.Value, "!")(1)).Value = cel.Offset(, 2).Value
endif
Next cel
0
 

Author Closing Comment

by:Bright01
ID: 39681977
That got it!  Thank you.

Have a happy thanksgiving......


B.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question