Results 1 to 7 of 7

LastRow and Multiple Ranges

Threaded View

dagindi LastRow and Multiple Ranges 05-17-2010, 03:37 PM
davegugg Re: LastRow and Multiple... 05-17-2010, 04:24 PM
dagindi Re: LastRow and Multiple... 05-17-2010, 06:02 PM
JBeaucaire Re: LastRow and Multiple... 05-17-2010, 05:53 PM
davegugg Re: LastRow and Multiple... 05-17-2010, 05:57 PM
JBeaucaire Re: LastRow and Multiple... 05-17-2010, 10:20 PM
dagindi Re: LastRow and Multiple... 05-21-2010, 09:21 AM
  1. #1
    Forum Contributor dagindi's Avatar
    Join Date
    06-02-2008
    Location
    New York, NY
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    295

    LastRow and Multiple Ranges

    I am using the following line of code in a bunch of different spreadsheets.

    LastRow = Range("A" & Rows.Count).End(xlUp).Row
        Range("A1:M" & LastRow).Copy
    The current whole code I am using it in is as follows:

    LastRow = Range("A" & Rows.Count).End(xlUp).Row
        Range("A1:M" & LastRow).Copy
        Workbooks.Add
        Range("A1").PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
    What I tried to do was the following:

    Range("A1:G,K1:L" & LastRow).Copy
    The above did not work.

    Since the main code is copying from one sheet to another, I was hoping that either the code i changed would work and if not how do I code the second copy/paste command to the book created by the Workbook.Add line. K1:L would need to be pasted into H:L on in the "existing" new book.

    I could also edit the existing code to just delete the rows I don't need but i was curious to know if multiple ranges could be selected
    Last edited by dagindi; 05-21-2010 at 09:22 AM.

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