+ Reply to Thread
Results 1 to 5 of 5

Copy and Paste rows to multiple worksheets based on a cell value.

Hybrid View

  1. #1
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Copy and Paste rows to multiple worksheets based on a cell value.

    Try this:
    Sub x()
    
    Dim r As Range
    
    For Each r In Sheets(1).Range("A2", Sheets(1).Range("A" & Rows.Count).End(xlUp))
        Select Case r.Offset(, 10)
            Case 1 To 14
                r.Resize(, 21).Copy Sheets(CStr(r.Offset(, 10) & "-gallon")).Range("A" & Rows.Count).End(xlUp)(2)
            Case Else
                r.Resize(, 21).Copy Sheets("14-gallon").Range("A" & Rows.Count).End(xlUp)(2)
        End Select
    Next r
    
    End Sub
    Remove the space in 13 sheet name.

  2. #2
    Registered User
    Join Date
    07-22-2013
    Location
    Washington US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copy and Paste rows to multiple worksheets based on a cell value.

    Awesome thanks so much. That was a lot less code than I thought it would take.

    Thanks for your help and time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy and Paste rows to another spreedsheet based on multiple sets of criteria.
    By juhaszp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2013, 11:08 AM
  2. Unique Copy and Paste Macro - Multiple Worksheets Based on IF (AND) criteria
    By dwalt75 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-16-2013, 04:49 PM
  3. copy rows from multiple worksheets to a new condition based on criteria
    By TheVoodoo in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-20-2012, 02:37 PM
  4. Insert a number of rows based on a cell value and copy formulas on multiple worksheets
    By Charleneq40 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2012, 12:45 PM
  5. Copy\Paste multiple criteria based rows to new sheet
    By namz in forum Excel Programming / VBA / Macros
    Replies: 46
    Last Post: 06-06-2008, 08:08 AM

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