+ Reply to Thread
Results 1 to 2 of 2

Loop through column and copy specific values to another sheet for calculations

  1. #1
    Registered User
    Join Date
    05-03-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question Loop through column and copy specific values to another sheet for calculations

    I would like to say that I am a newbie when it comes to writing VBA that is past a basic level and I hope this forum can help me out with a situation.

    Outline of the problem:
    I have Sheet1 that has two columns (A & B) which I need to draw data from. I need a macro that loops through column A until it finds a value that is not blank. For any row in column A that is not blank, there is a corresponding count value found in column B.

    When it finds a value in column A, the macro should copy that value to Sheet2 starting at A1. Then the macro needs to look at the corresponding count from Sheet1 column B to know that a formula must be run on the copied value (Sheet2 A1) for x amount of iterations based upon what the count (Sheet1 column B) was.

    Here's an example situation in action: Macro loops through Sheet1 column A. It finds its first value at A17 and copies that value. Then it looks at B17 and sees a count of 3. The value from Sheet1 A17 is pasted to Sheet2 A1 and a formula is ran on it in Sheet2 B2, B3, and B4 because the count was 3.

    After this, the macro should continue looping through Sheet1 column A till it finds its next value in say A1020 and copies that value with a corresponding count of 2. The value should then be pasted in cell Sheet2 A5 (I want a blank row between the last result and this new result) and the formula for the value in Sheet2 A5 should be calculated in B5 and B6.

    On thing to also note is that the formula in say B5 and B6 are not the exact same formula, but a formula that has been iterated downward like when you drag the corner of a cell downward.

    I hope my question is not too convoluted and I am happy to post any more information to help solve this problem.

  2. #2
    Registered User
    Join Date
    05-03-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Loop through column and copy specific values to another sheet for calculations

    I have received a solution to my problem on another forum and wanted to post it here in case anyone is looking to solve the same problem

    Please Login or Register  to view this content.
    I am not sure on the rules for posting a link to the other forum with the solution, but will be happy to share it upon request.

+ 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