+ Reply to Thread
Results 1 to 4 of 4

Copy and paste using Macros

  1. #1
    Registered User
    Join Date
    06-01-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    16

    Copy and paste using Macros

    Hi All,

    I've seen a few of the answers to previous questions relating to my issue, but haven't quite found the one to solve my problem. (could be my bad macro skills talking).

    I am tying to copy and paste 2 rows of data, assuming that another row is greater than 0.
    I have attached an example of the data.

    In my Worksheet "Book1" I want to copy and paste the values in Row 2 and Row 3 into another Worksheet "ExportData" if the value in Row 4 is >0.

    eg if D4 is > 0, then copy and paste values of D2 and D3, and then repeat this process across the row until there are no more values left

    I have also added in the worksheet how I expect it to look if it was copied and pasted into my other worksheet.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Copy and paste using Macros

    Hi Melyssa18,

    Welcome to the forum!!

    See how this goes (just change the 'strSourceTab' and 'strOutputTab' variables to suit):

    Please Login or Register  to view this content.
    Regards,

    Robert

    PS Can I make my payment in VB?
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    06-01-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copy and paste using Macros

    Thanks for your reply Robert...it almost makes sense!!

    Let's pretend you're writing a macros for dummies handbook..and I'm the dummy.

    I think my "sample" didn't quite accurately reflect what my actual spreadsheet looks like, so I have copied and pasted a more "realistic" version, including exactly where my columns and rows start and stop...I've tried to adapt your macro to these measurements but have failed...I thought a more proper look may help you explain it to me better!!

    So...I want to copy the range AS2:BC2 and range AS8:BC2 into a completely different workbook (not another tab in the same workbook) as long as the corresponding cell in range AS28:BC28 >0, otherwise ignore.

    Eg...based on the sample..I would have copied and pasted AS2 and AS8 into another workbook with a sheet name of "BDM Summary"..but not necessarily into exactly the same place in the new tab (eg. AS2 would be copied to B4 and AS8 would be copied to be B5...and we woudl continue this process across the rows until we got to column BC (assuming that's where the values end).

    Does this make sense? I'll send VB???
    Attached Files Attached Files
    Last edited by shg; 06-03-2010 at 10:35 PM. Reason: Deleted spurious quote

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Copy and paste using Macros

    Hi there,

    Might be best to start a new thread as the requirements you have now stated are quite different from you're original post.

    Good luck,

    Robert

+ 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