+ Reply to Thread
Results 1 to 2 of 2

loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook

  1. #1
    burl_rfc
    Guest

    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


  2. #2
    Bill Renaud
    Guest

    Re: 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



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1