Macro in Excel to move rows to another tab

Hi All,

I want to create a drop down menu in a field with reference values, and, depnding on the value selected, move the row to a different tab in the workbook.

Is this possible?  How would you suggest accomplishing?

Thanks,
Matt
mattturleyAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Saqib Husain, SyedConnect With a Mentor EngineerCommented:
Try this macro. You will have to complete the status assignments then run the macro.
Private Sub moverows()
Set stcol = ActiveSheet.Rows(1).Find("Status")
sr = ActiveSheet.Range("A65535").End(xlUp).Row
i = 2
Do
    Set cel = Cells(i, stcol.Column)
    If cel.Value <> ActiveSheet.Name Then
        cel.EntireRow.Copy Sheets(cel.Value).Rows(Sheets(cel.Value).Range("A65536").End(xlUp).Offset(1, 0).Row)
        cel.EntireRow.Delete
        i = i - 1
        sr = sr - 1

    End If
    i = i + 1
Loop While i <= sr
End Sub

Open in new window


I had considered moving the row as soon as the status was selected but the decided against it as it may cause problems, (eg if someone selects a wrong value it would have moved the row immediately to the selected sheet and will have to be moved back causing too much nuisance).

Saqib
0
 
SiddharthRoutCommented:
Matt, Please provide a sample sheet so that I can get my references correct.

Sid
0
 
Saqib Husain, SyedEngineerCommented:
We might be able to help you if you provide a sample file.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
mattturleyAuthor Commented:
Attached is a sample file.  Goal is to move rows when a statu is selected.  Status and tabs are named the same. demo-ai-list.xls
0
 
SiddharthRoutCommented:
Matt: Could you please confirm if the above worked for you as I had also worked on the above and I have the sample file ready. My code using a different logic though.

Sid
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.