+ Reply to Thread
Results 1 to 6 of 6

Move rows into worksheet depending on cell value

Hybrid View

  1. #1
    Registered User
    Join Date
    12-17-2008
    Location
    edinburgh, uk
    Posts
    46

    Move rows into worksheet depending on cell value

    Hi Guys,
    Need a little bit of help. I've got a workbook with various worksheets in it.

    One of the worksheets contains all of the data and the rest are empty.

    What I need to do is move entire rows of from the main worksheet in to worksheets named the same as the value in column C of the row.

    for example one row may have TEST in column C so i want to move it to the worksheet called TEST. The next row might have TESTING in column C so that would go to the worksheet called TESTING. and so on.

    thanks in advance!
    Last edited by mattmac; 07-07-2009 at 06:22 AM.

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Move rows into worksheet depending on cell value

    Hi
    try the attached macro
    Ravi
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-17-2008
    Location
    edinburgh, uk
    Posts
    46

    Re: Move rows into worksheet depending on cell value

    Just what I was looking for. Thank you!

  4. #4
    Registered User
    Join Date
    09-01-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Move rows into worksheet depending on cell value

    Hi
    Can you please tell me how i access this macro?
    thanks

  5. #5
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Move rows into worksheet depending on cell value

    I've made the following code:
    Sub CopyPaste()
    
    Dim Ccell As Range
    Dim Ws As Worksheet
    Dim RowCounter() As Long
    
    ReDim RowCounter(Sheets.Count)
    
     For Each Ws In Worksheets
     RowCounter(Ws.Index) = 1
    
     For Each Ccell In Range("Sheetname") 'Sheetname defined in Excel names
      If Ws.Name = Ccell.Value Then
        Ccell.EntireRow.Copy
        ActiveSheet.Paste Destination:=Sheets(Ws.Name).Cells(RowCounter(Ws.Index), 1)
        RowCounter(Ws.Index) = RowCounter(Ws.Index) + 1
      End If
     Next
    Next
    End Sub
    Attached Files Attached Files
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Move rows into worksheet depending on cell value

    Ihe,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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