+ Reply to Thread
Results 1 to 14 of 14

Copy/Cut entire row to another sheet based on cell value

  1. #1
    Forum Contributor excelkeechak's Avatar
    Join Date
    07-21-2008
    Location
    India.
    MS-Off Ver
    2013 /2016
    Posts
    363

    Copy/Cut entire row to another sheet based on cell value

    Based on the example and solutions from one of our friends post
    http://www.excelforum.com/excel-prog...ell-value.html.

    i want to know the code with the same data as posted in THAT example,changing the data slightly like adding "TODAY" & "TOMMORROW" as other key words which will be Cut/Copied as seperate groups one beneath the other.

    I had attached the worksheet with the actual data & the final Required format.
    Thanks for the help.
    Attached Files Attached Files
    Last edited by excelkeechak; 02-02-2010 at 11:11 AM.
    THANKS
    ExcelKeechak

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,788

    Re: Copy/Cut entire row to another sheet based on cell value

    Perhaps something like this?

    Sub Macro1()
    '
    '

    Range("Req_Format!A1:H" & Range("Req_Format!A" & Rows.Count).End(xlUp).Row).Clear

    Range("ACTUALSHEET!D4").AutoFilter Field:=4, Criteria1:="Everyday"
    Range("A1:H" & Range("A" & Rows.Count).End(xlUp).Row).Copy
    Range("Req_Format!A1").PasteSpecial Paste:=xlPasteAll

    Range("ACTUALSHEET!D4").AutoFilter Field:=4, Criteria1:="Today"
    Range("A1:H" & Range("A" & Rows.Count).End(xlUp).Row).Copy
    Range("Req_Format!A" & Rows.Count).End(xlUp).Offset(2, 0).PasteSpecial Paste:=xlPasteAll

    Range("ACTUALSHEET!D4").AutoFilter Field:=4, Criteria1:="Tommorrow"
    Range("A1:H" & Range("A" & Rows.Count).End(xlUp).Row).Copy
    Range("Req_Format!A" & Rows.Count).End(xlUp).Offset(2, 0).PasteSpecial Paste:=xlPasteAll

    Application.CutCopyMode = False

    Selection.AutoFilter


    End Sub
    I had to rename "Req Format" to "Req_Format". Seems like Excel 2003 do not like blanks in tag names.

    HTH

    Alf
    Last edited by Alf; 01-31-2010 at 07:24 AM.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Copy/Cut entire row to another sheet based on cell value

    Based on JBeaucaires earlier post -
    http://www.excelforum.com/excel-prog...ell-value.html.
    Cut entire row to another sheet based on cell value
    Please Login or Register  to view this content.
    No problem with sheet name "Req Format"
    Last edited by Marcol; 01-31-2010 at 07:45 AM. Reason: Added html reference for earlier post.

  4. #4
    Forum Contributor excelkeechak's Avatar
    Join Date
    07-21-2008
    Location
    India.
    MS-Off Ver
    2013 /2016
    Posts
    363

    Re: Copy/Cut entire row to another sheet based on cell value

    Sorry Friends.I m not getting the desired result from your code

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Copy/Cut entire row to another sheet based on cell value

    Sorry forgot to reference your sheet name.

    error in line
    Please Login or Register  to view this content.
    Should be
    Please Login or Register  to view this content.
    Also remember to use
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor excelkeechak's Avatar
    Join Date
    07-21-2008
    Location
    India.
    MS-Off Ver
    2013 /2016
    Posts
    363

    Re: Copy/Cut entire row to another sheet based on cell value

    Thanks a lot Friend.That worked well.Thanks for Sparing your time.

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Copy/Cut entire row to another sheet based on cell value

    If you are happy with the solution.

    Remember to change the prefix to [SOLVED]

    If the solution helped and you wish to add to any of contributors reputations, click the scales icon in top right hand corner of the thread.

  8. #8
    Forum Contributor excelkeechak's Avatar
    Join Date
    07-21-2008
    Location
    India.
    MS-Off Ver
    2013 /2016
    Posts
    363

    Re: Copy/Cut entire row to another sheet based on cell value

    what would be the generalised code for this problem. I mean if i need to change the words in the array
    Please Login or Register  to view this content.
    to any of my words or if my requirement is more than the three words here how would i do it.is it sufficient to change only the array words or do i need to change the code also. please tell me

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Copy/Cut entire row to another sheet based on cell value

    Just change to suit your needs.
    Please Login or Register  to view this content.
    for example
    Please Login or Register  to view this content.
    The code will handle as many, or as little, as you need. Just remember to keep strings in quotes and separate with commas.

    If you want to use variables instead of strings the code will still be okay only difference being you will not need to use quotes
    for example
    Please Login or Register  to view this content.
    See VBa help "Array Function"

  10. #10
    Forum Contributor excelkeechak's Avatar
    Join Date
    07-21-2008
    Location
    India.
    MS-Off Ver
    2013 /2016
    Posts
    363

    Re: Copy/Cut entire row to another sheet based on cell value

    OK.Thanks a lot for the Reply.

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Copy/Cut entire row to another sheet based on cell value

    Hi tube

    Welcome to the forum.

    You should start a new thread, not ask a new question in a thread of another member, even if it seems related.

    There is nothing wrong with the content of your question, referencing another thread as you have done is good. The only thing you haven't done is wrap your code in code tags.

    Please read the forum rules then post your question accordingly.

    Sorry to be a pain, but Rules are Rules.

    Cheers

  12. #12
    Registered User
    Join Date
    10-11-2010
    Location
    sydney Australia
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Copy/Cut entire row to another sheet based on cell value

    Thanks Marcol,

    will do!

  13. #13
    Registered User
    Join Date
    11-02-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Copy/Cut entire row to another sheet based on cell value

    I am also trying to do something similar. I want to move rows that have entered stage "4" into the current projects worksheet. So when the cell in Column A shows the number 4 I want it to then take that data and copy the row to the Current projects.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    11-02-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Copy/Cut entire row to another sheet based on cell value

    Ok, wow, just read what you said. I'll start a new thread - I thought that's what I did but it ended up here in the reply section.

+ 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