+ Reply to Thread
Results 1 to 5 of 5

vba to create 2 rows of data from 1 row

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Unhappy vba to create 2 rows of data from 1 row

    Hi,

    I am trying to extract certain columns from a row to another row in anothe worksheet, which is working.

    so data looks like this.

    aaaa bbbb date figure 1 figure 2 mmmmm xxxxx yyyyy

    extracted data should look like this

    aaaa date figure 1 mmmmm xxxxx
    bbbb date figure 2 mmmmm yyyyy

    If I only have one original line my code worked perfectly, However, when I have say 4 original rows the 1st line of extracted data comes out ok but the second line does not.
    I am using R1C1 formula filling down to extract the data. which is ok if there is only I line cause the formula would be R1C1 for extract 1, and R-1C1 for extract 2. But if I have the additional lines the 2nd extract pulls nothing as it is pointing to the wrong place.

    Here is the code I have sofar based around a loop
    Please Login or Register  to view this content.

    Can anyone assist me with this as I am really stumped?
    Thanks
    Andy
    Attached Files Attached Files
    Last edited by andy booth; 02-12-2013 at 01:45 PM. Reason: attached file for example

  2. #2
    Registered User
    Join Date
    12-28-2009
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    71

    Re: vba to create 2 rows of data from 1 row

    Hi, Andy.
    Try replacing this piece of the second code you posted above
    Please Login or Register  to view this content.
    By this
    Please Login or Register  to view this content.
    This will continue inserting formulae, tell us if you prefer the values instead.
    Osvaldo

  3. #3
    Registered User
    Join Date
    01-15-2013
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: vba to create 2 rows of data from 1 row

    Hi,

    yes this works for me. Thanks for the help with it.
    Can you explain what this means...what was I not understanding?

    If i just wanted the values what would I do different....is it something like using "=.value"
    Let me know if you can thanks.

    Andy

  4. #4
    Registered User
    Join Date
    12-28-2009
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    71

    Re: vba to create 2 rows of data from 1 row

    What I meant is: your code pulls some information from a sheet and put it in another. It was written to perform this task through formulae. So if there are changes in the source worksheet the result of the formula will be updated. If you will not use this feature then you can rewrite the code to pull the values ​​directly, this way the values will not be upgraded until you run the code again.

    If you want try this way, change that same piece of code to this (which could be simplified later):


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-15-2013
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: vba to create 2 rows of data from 1 row

    THanks very much for this help.
    It worked great.
    Andy

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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