# Loop through column and find value on a different sheet, then apply formula to entire row

1. ## Loop through column and find value on a different sheet, then apply formula to entire row

Sheet "Forecast" has rows with different categories, and also rows that include CURRENCY names such as "US Dollar", "Swiss Franc", ... In these rows there are at some cells amounts in number (eg 100).

I n sheet "Currency" I have a table with rows of all possible curreny names (eg US Dollar) and to the right there is the value it needs to be multiplied by so it shows the euro amount.

SO the macro I am trying to build should:
go through each cell of the column in "Forecast" sheet that includes the currency names, if the cell matches a name of the currencies from "Currencies" sheet table, then it should get all values of the row where that cell is and if they are numbers multiply them by the value to the right of the matched currency.

It is my first time with VBA so this is my first (completely wrong) code for it.:

``Please Login or Register  to view this content.``

Thank you everyone for the help

2. ## Re: Need help for complex Macro

It would be easier to help and test possible solutions if you could attach a copy of your file. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary). See the yellow banner at the top of this page for instructions to attach a file.

3. ## Re: Need help for complex Macro

Thank you. I uploaded the file at the original post.

The goal is that when you click convert the numbers in the rows that include US dollar or Swiss franc... are multiplied by (e.g 100 usd * 0,8)

4. ## Re: Need help for complex Macro

For clarification let's use a few examples.

When you loop through column C of the Forecast sheet , the second currency is US Dollar in cell C19. In the Currency sheet, the number to the right of US Dollar is 1.18721. You want to multiply all the values in row 19 by 1.18721. Is this correct?

When you loop through column C of the Forecast sheet , the first currency is EUR in cell C18. In the Currency sheet, the number to the right of EUR is 1.00. I would assume that you would not need to multiply the values in row 18 by 1.00 because the result would not change. Is this correct?

You then want to repeat this process for all the currencies in column C. Is this correct?

If I didn't understand properly, please explain what you want to do in the same manner as I explained above.

When would you use the values in column D of the Currency sheet?

5. ## Re: Need help for complex Macro

Sorry, in the first post I said the one to the right but it actually meant two to the right. SO everything you said is right, only that I need to multiply with the second value, so in your example US Dollar of cell 19 means all numbers in that row get multiplied by 0.842311 instead of 1.18721

6. ## Re: Need help for complex Macro

Hello delacomarca. Welcome to the forum.

Welcome to the forum.

We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

(Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

7. ## Re: Loop through column and find value on a different sheet, then apply formula to entire

Assign this macro to the "Convert to EUR" button and click it.
``Please Login or Register  to view this content.``

8. ## Re: Loop through column and find value on a different sheet, then apply formula to entire

Thanks so much Mumps1!, The code works perfectly!

9. ## Re: Loop through column and find value on a different sheet, then apply formula to entire

You are very welcome.

There are currently 1 users browsing this thread. (0 members and 1 guests)