Link to home
Start Free TrialLog in
Avatar of Bright01
Bright01Flag for United States of America

asked on

Currency Conversion Integration Fix

EE Pros,

I have a great WB and set of Macros that Gowflow has created for me and now I'm scaling it.  

I have one change so far as I integrate his work into my master WB;  I need a column of cells ("I" in Currency) to recognize the value and any changes, that are created by a formula within the cell it is converting ("H" in Currency which is linked via a formula to another cell in another WS.  Right now, I must make the change in the cell itself or put the curser at the end of the formula and click to get it to make the change.; I need to make the change in the source cell in "Demos", that should then automatically update the conversion amount.

I have attached the sample for you.

Thank you in advance.

B
Copy-of-Currency-Update-and-Disp.xlsm
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Sorry but I don't understand your request at all could you explain it in a better way ?
gowflow
Opps !!!! I just noticed something (I hope you haven't used an old version of the macro when you transferred the code to your production WB as)

The code in sheet Currency that I found in the attached workbook is:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns(8)) Is Nothing Then
    UpdateCurrency Target
End If
End Sub

Open in new window


Whereas the Code that I posted in the last solution that would take care of changes in Col H to reflect on Col I is for this same Currency worksheet:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns(8)) Is Nothing Or Not Intersect(Target, Columns(7)) Is Nothing Then
    UpdateCurrency Target
End If
End Sub

Open in new window


Try replacing the actual code by this last one in sheet Worksheet_change event of sheet Currency and see if it solve your issue.

gowflow
Avatar of Bright01

ASKER

Gowflow,  Greetings!  Just put in your change but that's not the issue.  Let me do a better job explaining.  

If you open the model I sent, you will see a new tab called "Demos".  Go to I7 or I8 and change the Amount.  You will see it did get reflected in the Currency Tab.  HOWEVER, it will not update the conversion automatically unless you put your cursor in the cell with the new data (In Currency) and hit "return".....then it updates.  What I'm attempting to have it do is automatically update from the Demo Tab when the cells are changed there, and return the new currency value (and format) to the Demo Tab in the corresponding Cells Column J.

Hope that helps.

B.
ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Gowflow!  This works very well for what I need!  Although I did say I wanted it (the currency reflected in the "Demos" tab where the formula returned the value, I don't have to have it because you have already allowed me to "reference" a cell in the "Currency" Tab and the Demos tab will be hidden anyway.

Much thanks...... you love a good challenge.  Unique talent!

B.
Can you comment on the specific line(s) you changed so I can simply refine those lines or is it more complicated and I should simply replace a section?

B.
no problem here is the new code beside the one I already included as per my last comment. So these are the codes that were not identical in the workbook you posted.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns(8)) Is Nothing Or Not Intersect(Target, Columns(7)) Is Nothing Then
    UpdateCurrency Target
End If
End Sub

Open in new window


I included this in the code of worksheet Currency. This is triggered each and every time any formula need recalculation and this is when we need to refresh the cacluation of currency module.

Private Sub Worksheet_Calculate()
Dim Target As Range
Set Target = ActiveCell
UpdateCurrency Target

End Sub

Open in new window


We tell it to simply affect the current cell (which is Demo something or any other cell and this does not matter) but what is important is that it runs the UpdateCurrency routine and that is what we are after so it simulate as if you go on the currency tab and change manually something in the cells that affect this routine.

Now as regards to the formatting I can include a code in the vba that would give you the formatting in the cell that you want in Demo but this does not mean that if you copy the formula to any cell that you will get the formatting as well. So your choice do you want me to incorporate this in the code ?

gowflow
Gowflow,

I almost have it.  What is the specific code that updates the converted currency cells in "Demos"?   That's the only thing that isn't working in my production code.

TY,

B.
Well no code in Demos !!! that's the trick.

You should make sure to have the above code put in sheet Currency only. The most important part is the Calculate Event it is the one that triggers the update. This way if you put any reference to any other sheet in any sheet it will give you the result updated provided you have the routine set above in the calculate event. I put it again here.

Make sure you have the following cod in Currency sheet
Private Sub Worksheet_Calculate()
Dim Target As Range
Set Target = ActiveCell
UpdateCurrency Target

End Sub

Open in new window


gowflow
Did it work for you ?
gowflow
Gowflow,  been working on it all morning!  Have one error due to me adding a selection process in the Demos WS.

Here is the new question:

https://www.experts-exchange.com/questions/28342116/Problem-with-the-Integration-of-Macro-for-Demo-Currency-Program.html

Thank you.