Selecting variable rows to copy and paste

  • Hi


    I've been working through a spreadsheet, with no small amount of help from you guys, and got a little stuck again. I need to find a way to look at a spreadsheet and copy only the rows with data in column A. There will be no instances of blank lines in between complete lines.


    Thanks for reading


    Bert

  • Re: Selecting variable rows to copy and paste


    Hi bert


    try using autofilter and filter column A with nonblanks and copy the record set


    regards
    youtham

  • Re: Selecting variable rows to copy and paste


    Thanks Youtham


    Not sure that that would work quite how I need. The macro that I've recorded is attached to a button. When pressed it needs to look down Column A until it finds a blank, then copy all the rows (which consist of column A - M) above and save as a CSV file. The code is below and as you can see I'm just copying A2:L34 knowing that there will be no more than 34 rows of info. It all works until except that when the data is saved as a CSV file it carries through delimiters for the blank cells that I don't need. Sorry If I've mis-uinderstood your suggestion.


    Do you know if there is a bit of code that could resolve this???


    thanks again


    Bert


  • Re: Selecting variable rows to copy and paste


    Hi


    try this




    regards
    youtham

  • Re: Selecting variable rows to copy and paste


    Thanks Youtham - that's just what I was after except that it doesn't seem to work if the area to be copied is just one row ie. row 2. Do you know how to account for this scenario.


    Thanks v much


    Bert

  • Re: Selecting variable rows to copy and paste


    Hi Bert


    My damn silly mistakes


    try this for R value



    Code
    R = ActiveSheet.Range("a65536").End(xlup).row


    regards
    Youtham

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!