+ Reply to Thread
Results 1 to 8 of 8

VBA to Move Row in a Sheet Based on Cell Value

  1. #1
    Registered User
    Join Date
    08-08-2016
    Location
    England
    MS-Off Ver
    2021
    Posts
    7

    Question VBA to Move Row in a Sheet Based on Cell Value

    Looking for some help.

    Found a few VBA codes online and tried to modify them to function correctly in my workbook, but I just can't seem to make them work?

    I need it to do the following:


    Sheet 2 is named 'TSP Milestone Tracker' and contains the main data.

    The main data is in cells B5:J10 with the headings on said data in B4:J4

    Cells B5:B10 contains the status of each line

    I want the VBA to do the following: If for example the data in cell B5 reads 'Complete', the entire line (B5:J5) is to be moved to another sheet named 'TSP Milestone Value' in the B5:J5 location

    Each subsequent line of data marked 'complete' needs to then move to the next available line on the 'TSP Milestone Value' sheet.


    Hopefully this makes sense? I can send the file over if needed.

    Thanks in advance.


    Edit: Sample file now attached.
    Attached Files Attached Files
    Last edited by samjbeattie; 05-07-2020 at 01:14 PM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: VBA to Move Row in a Sheet Based on Cell Value

    See big yellow banner at head of page - how to send a workbook

  3. #3
    Registered User
    Join Date
    08-08-2016
    Location
    England
    MS-Off Ver
    2021
    Posts
    7

    Re: VBA to Move Row in a Sheet Based on Cell Value

    Apologies, sample file now attached.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: VBA to Move Row in a Sheet Based on Cell Value

    Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet "TSP Milestone Tracker" and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter your data starting in column C to column J and then lastly, make a selection in column B. It is important that column B is populated after columns C to J.
    Please Login or Register  to view this content.
    Last edited by Mumps1; 05-07-2020 at 01:28 PM.
    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.

  5. #5
    Registered User
    Join Date
    08-08-2016
    Location
    England
    MS-Off Ver
    2021
    Posts
    7

    Re: VBA to Move Row in a Sheet Based on Cell Value

    This is almost working.

    However, if the selection in B5:B10 is 'Complete' I'd like the line to move to the 'TSP Milestone Value' sheet, not just copy.

    Also if possible, the lines below then all move up to fill the gap?

    Are you able to make this change?

    Thank you.

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: VBA to Move Row in a Sheet Based on Cell Value

    Try:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-08-2016
    Location
    England
    MS-Off Ver
    2021
    Posts
    7

    Re: VBA to Move Row in a Sheet Based on Cell Value

    Perfect, thank you!

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

    Re: VBA to Move Row in a Sheet Based on Cell Value

    My pleasure.

+ 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. move row to another sheet based on cell value
    By chelsy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-19-2019, 05:59 PM
  2. [SOLVED] Move row to another sheet based on cell value
    By M5B in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 12-14-2018, 05:37 PM
  3. [SOLVED] Move Row(s) To Another Sheet (One of Five) Based On One+ Cell Value
    By gothope? in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2016, 07:23 AM
  4. [SOLVED] Move Row To a Particular Sheet Based on Cell Value
    By sliesneekr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-02-2016, 12:16 PM
  5. Move an entire row to a new sheet based on the value of a cell.
    By jgroathouse in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-05-2014, 08:16 PM
  6. VBA CODE to move rows from one sheet(1) to another sheet(2) based on data in cell
    By fozzieulo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2013, 02:43 PM
  7. Macro to move rows from one sheet to another sheet based on a cell vaule
    By d55272 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-09-2012, 03:33 PM

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