ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook (https://www.excelbanter.com/excel-programming/357672-loop-through-column-workbook-copying-data-each-row-another-workbook-then-copy-data-back-original-workbook.html)

burl_rfc

loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook
 
I have a need for sometype of loop control, I have a workbook where on
column E and G i'd like to copy data to another workbook. The data in
column E will be placed into a second workbook in cell B1, the value
copied is then multiplied by 25.4. In column G of the first workbook I
then copy it's value to the second workbook and place into cell B3, it
is then multiplied by 1000.

The second workbook I can then perform some calculations, which I've
figured out already by macro, the value in cell B7 resulting from the
calculations is then placed into column K on the first workbook, but on
the same row I took the origianal data from. The macro would then
continue looping through until no more records are present in column E.

Can anyone help

Regards

burl_rfc


Bill Renaud[_2_]

loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook
 
Could you simply add a user-defined function in the workbook that has the
data in columns E and G?
In other words, insert a module into the workbook, then add a function like
the following:

Public Function MyCalculation(ValueE, ValueG) as double
MyCalculation = 25.4 * ValueE + 1000. * ValueG 'Or whatever the math
function is.
End Function

If you do not want to add the user-defined function in the workbook that has
the data, then the function could be left in another workbook. After
entering the formula in column K and filling down the worksheet, copy and
pastespecial the values to eliminate the link to the workbook with the
uwer-defined function.

Maybe your function is too complicated for this or uses other lookup tables,
etc.
--
Regards,
Bill




All times are GMT +1. The time now is 10:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com