+ Reply to Thread
Results 1 to 15 of 15

Move Information from One Sheet to Another if a Cell Shows A Certain Value

  1. #1
    Registered User
    Join Date
    09-28-2023
    Location
    London, England
    MS-Off Ver
    MS 365 Version 2307 64-bit
    Posts
    24

    Move Information from One Sheet to Another if a Cell Shows A Certain Value

    Hello,

    I am creating a spreadsheet to display the required "kits" that are needed for orders.
    The sheet displays the item number and the base part required to create the kit.
    It also shows the status of the operation so the requester has visibility.

    What I am hoping to achieve is, when the cell in column F is changed to "Complete", the entire row is moved over to a separate worksheet (named "Archive" in the example sheet).
    I have managed to use VBA to create a command that facilitates this; however, I have also encountered a couple of issues:
    - I need the values only to move, not the formulas that apply to the cells
    - I need to have the workbook protected so no users can accidentally delete or alter the formulas
    - The command I have written would need to run automatically as soon as the cell is changed to "Complete"

    I have been pulling my hair out trying to figure this out, being relatively new to these functions, so would welcome any solutions available.

    Many thanks!
    Attached Files Attached Files

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

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    Which columns contain the formulas?
    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
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this !


    For starters a VBA event procedure to paste only to Sheet1 (Main Sheet) worksheet module :

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
        If 
    Target.Column <> Or Target(1) <> "Complete" Then Exit Sub
        Application
    .EnableEvents False
        With Range
    (Target(1, -4), Target(1)):  = .Value:  .Delete xlShiftUp:  End With
        With Sheet2
    .[A1].CurrentRegion.Rows:  .Item(.Count 1) = V:  End With
        Application
    .EnableEvents True
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,958

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    1) Copy this code.
    2) Right-Click the sheet tab of "Main Sheet"
    3) Select "View Code"
    4) Paste the code into the window that appears.
    5) Save the file as a macro-enabled .xlsm file.
    6) Make changes as needed


    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,958

    Re: Hello, try this !

    Marc,

    This line will throw an error is Target isn't a single cell:

    Please Login or Register  to view this content.

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

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    I think we have to give consideration to the OP's request to protect the formulas.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Hello, try this !


    Quote Originally Posted by Bernie Deitrick View Post
    This line will throw an error is Target isn't a single cell
    Thanks, my post #3 already updated …

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value


    Bernie, to avoid your codeline may crash
    Please Login or Register  to view this content.
    you should use CountLarge rather than Count

  9. #9
    Registered User
    Join Date
    09-28-2023
    Location
    London, England
    MS-Off Ver
    MS 365 Version 2307 64-bit
    Posts
    24

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    Hi!
    In the example sheet, it's columns A, C and D that have the formulas that need to remain active.

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,958

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    If they are changing more than 2,147,483,647 cells at once then they deserve to crash!

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

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    Start by unprotecting all the cells in columns A, C and D. If you need help with this, let me know. Then protect the Main Sheet using a password of your choice. Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your Main Sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Change the password in the code (in red) to match your password.
    Close the code window to return to your sheet. Select "Complete" in column F.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    09-28-2023
    Location
    London, England
    MS-Off Ver
    MS 365 Version 2307 64-bit
    Posts
    24

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    Quote Originally Posted by Mumps1 View Post
    Start by unprotecting all the cells in columns A, C and D. If you need help with this, let me know. Then protect the Main Sheet using a password of your choice. Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your Main Sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Change the password in the code (in red) to match your password.
    Close the code window to return to your sheet. Select "Complete" in column F.
    Please Login or Register  to view this content.
    Thank you, this has worked perfectly!

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

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    You are very welcome.

  14. #14
    Registered User
    Join Date
    09-28-2023
    Location
    London, England
    MS-Off Ver
    MS 365 Version 2307 64-bit
    Posts
    24

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    Quote Originally Posted by Mumps1 View Post
    Start by unprotecting all the cells in columns A, C and D. If you need help with this, let me know. Then protect the Main Sheet using a password of your choice. Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your Main Sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Change the password in the code (in red) to match your password.
    Close the code window to return to your sheet. Select "Complete" in column F.
    Please Login or Register  to view this content.
    Sorry, one more question: I have another spreadsheet that I need to add this macro too as well; however, it has more columns (so the target column for the "Complete" status is different) and a different name for the sheet the info needs to be moved to.
    Please may you confirm which parts I would need to amend to get the macro to work with the new sheet?
    I thought I knew but I'm definitely missing something obvious.

    Thank you again!

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

    Re: Move Information from One Sheet to Another if a Cell Shows A Certain Value

    To avoid clutter, please use the "Reply" button instead of the "Reply With Quote" button.
    Place the code below in the code module of the new sheet. Change the column number (in red) to the column number of the target column and the sheet name (in blue) to the name of the new destination sheet.
    Please Login or Register  to view this content.
    Last edited by Mumps1; 01-10-2024 at 12:40 PM.

+ 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. Macro to move information from one workbook sheet to another
    By cory0789 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2016, 12:58 AM
  2. Replies: 3
    Last Post: 11-17-2015, 09:48 AM
  3. move information in different tables in sheet1 to a calculation in sheet 2
    By Kim-Aleksander in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-11-2015, 05:03 AM
  4. [SOLVED] Cell referenced in formula has no information displayed (shows blank), return blank cell
    By nunayobinezz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-07-2013, 04:51 PM
  5. Automatically move information from one sheet to another
    By eclair in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-16-2013, 11:26 AM
  6. Move information from one sheet into another
    By preatygirl75 in forum Excel General
    Replies: 1
    Last Post: 11-20-2007, 06:14 PM
  7. Macro - Move information from Sheet 1 to Sheet 2
    By Barbosa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-14-2006, 04:17 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