+ Reply to Thread
Results 1 to 25 of 25

Move row to another worksheet base on a cell value

  1. #1
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Move row to another worksheet base on a cell value

    Hi There,

    In coloumn D i have a data validation list (N,Y,NA). If "N" is selected I want the entire row to move to the worksheet called "Declined Referrals".

    How can i do this?

    Many thanks
    Jess

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Move row to another worksheet base on a cell value

    Hi Jess. Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    Hi there,

    Thank you for your quick response. Doesn't seem to work though :/

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    That worked great, thank you. Is there a way to remove it from the original worksheet once it has been copied to the 'Declined Referrals'.

    Many thanks
    Jess

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    Brilliant, thank you

  8. #8
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    Sorry spoke too soon. It is showing run-time error '13' - Type mismatch. When i press debug it is highlighting "If Target.Value = "N" Then

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    Change too: If Target.Text = "N"

  10. #10
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    Hi,

    What does the End(3)(2) do? Only I have copied the code to use in a new spreadsheet and it has come up with run-time error 9. This is teh new code



    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns(13)) Is Nothing Then
    If Target.Text = "Blue" Then
    Rows(Target.Row).Copy Sheets("Embedded as Business as Usual").Range("A" & Rows.Count).End(3)(2)
    Rows(Target.Row).Delete
    End If
    End If
    End Sub

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    It places the copied row on the destination sheet to the first in ununsed cell in Column A. Check your destination Sheets name. Spelling, spaces ect.

  12. #12
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    *blushes* whooops you were right.

    sorry and thank you

  13. #13
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    Sorry me again, I've noticed an actual probem this time. When it is transferring to the next worksheet it is deleting the row that was there before instead of adding it underneath

  14. #14
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    Can you attach a sample where that is occuring? It shouldn't overwrite anything.

  15. #15
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value


  16. #16
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    Umm. You have merged cells in your sheets, which can cause problems. Can something like this help?

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    Sorry, it's still deleting rows

  18. #18
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    This one is working for me on the sample provided?

    Please Login or Register  to view this content.
    I also changed this:

    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    It's very strange as it was working perfectly before. I'll attach my one again.

  20. #20
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value


  21. #21
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    Try it now.
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    Sorry it's still doing it but this time with run-time error '1004': method 'intersect of object_global'failed. Could it be my computer because it used to work fine?

    Thank you

  23. #23
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    I dunno. It works on mine?

  24. #24
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Move row to another worksheet base on a cell value

    I've worked it out, it's happening when A1 is blank on the previously copied across row, so it thinks teh whole row is blank and pastes over it. Can we ask it to check if column B is empty?

    Many thanks
    Jess

  25. #25
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Move row to another worksheet base on a cell value

    I'm not sure what you mean? The code provided is relative too what's in Column D not A or B, because on your spreadsheets Columns A,B and C are merged.

+ 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. [SOLVED] Macro to move selected cells in a data base
    By nico125 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2013, 11:12 AM
  2. move anyfile base on filename
    By zhaype in forum Excel General
    Replies: 0
    Last Post: 07-16-2013, 02:23 AM
  3. [SOLVED] How do I make values in a cell in one worksheet move to another worksheet
    By icevinson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2013, 06:46 PM
  4. Need to move data that matches criteria in cell and move to new worksheet
    By panagle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2013, 09:23 AM
  5. Replies: 1
    Last Post: 02-14-2012, 07:00 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