• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Modifying Excel VBA Code for Conditional Moving of Rows

mosaadmattar7

New Member
Dear Excel Experts,


I'm working on an Excel file and need assistance modifying a VBA code. Your expertise would be greatly appreciated in refining this functionality. Here's what I'm trying to achieve:


  1. When clicking "MOVE" and cell P17 contains "ATIVE":
    • Move the row to the "CURRENT" sheet, appending it to the last row.
  2. When clicking "MOVE" and cell P17 contains "FINISHED":
    • First, move the row to the "CURRENT" sheet, appending it to the last row.
    • Then, search for rows in the "CURRENT" sheet that contain "FINISHED" in column U.
    • Move (not copy) these "FINISHED" rows to the "FINISHED" sheet.

I have a basic structure, but I'm struggling with implementing these conditions correctly. Any help or guidance would be immensely valuable.


Thank you in advance for your time and expertise!
 

Attachments

  • data.xlsm
    714.8 KB · Views: 1

mosaadmattar7

Three questions:
Your sample data has none ACTIVE or FINISHED value in P17 --- how to verify moving?
Do You really want to move the row ... really the whole row from A-column until end of row?
... O-column has some writings as well as columns C...K
Do Your move really means about move? ... ~ copy and delete
 

mosaadmattar7

As You've read from Forum Rules (everywhere has same kind of rules)
  • Cross-Posting. Generally, it is considered poor practice to cross post. That is to post the same question on several forums in the hope of getting a response quicker.
  • If you do cross-post, please put that in your post.
  • Also if you have cross-posted and get an Solution elsewhere, have the courtesy of posting the Solution here so other readers can learn from the answer also, as well as stopping people wasting their time on your answered question.
These rules are for everyone.
 

mosaadmattar7

Three questions:
Your sample data has none ACTIVE or FINISHED value in P17 --- how to verify moving?
Do You really want to move the row ... really the whole row from A-column until end of row?
... O-column has some writings as well as columns C...K
Do Your move really means about move? ... ~ copy and delete
"1 - Sorry, currently the file has the cell P17 containing 'Finished'.


2 - Yes, if cell P17 contains 'Active', it copies the row AJ4:AU4 from the 'BUY-SELL' sheet and pastes it to the 'CURRENT' sheet starting from column 'I', of course below the last row with data - then it returns to the 'BUY-SELL' sheet.


However, if cell P17 contains 'FINISHED', it does all of the above and additionally:First, it copies all rows from the 'CURRENT' sheet where column 'U' contains the word 'FINISHED', starting from column 'I' up to column 'U', and pastes them to the 'FINISHED' sheet.Then, it moves (deletes) all rows from the 'CURRENT' sheet where column 'U' contains the word 'FINISHED'.


Note: In the attached example, you will find that the 'CURRENT' sheet does not have the word 'FINISHED' in column 'U', but it is assumed that when you click on MOVE, it will change to 'FINISHED'."
 

Attachments

  • data.xlsm
    714.9 KB · Views: 0
Back
Top