Solved

Macro in Excel to move rows to another tab

Posted on 2011-02-25
7
267 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:mattturley
7 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34985964
Matt, Please provide a sample sheet so that I can get my references correct.

Sid
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 34985966
We might be able to help you if you provide a sample file.
0
 

Author Comment

by:mattturley
ID: 35147970
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 35151888
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
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35162859
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
 
LVL 50

Expert Comment

by:teylyn
ID: 35744597
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now