Okay so here is what I'm looking at:
I have an 'active pipeline' worksheet. Each row contains a potential lead. When I select 'Booked' I'd like that row to move to the 'Booked' worksheet. Also, when I select 'DNMQ' I'd like that row to move to the 'DNMQ' worksheet. I have tried for days to work out the coding for it and I just cant get anything to work. The cell that will contain 'Booked', DNMQ or other values will be in Column D. Please please help!
Last edited by bdf0827; 09-04-2011 at 02:28 PM.
bdf0827,
Welcome to the Excel Forum.
Sounds like you could use the Worksheet_Change Event in worksheet active pipeline.
It sounds like you are using DataValidation in column D.
Do you want the row to be copied to the correct worksheet? Or, copied to the correct worksheet, and then deleted from worksheet active pipeline?
So that we can get it the first time can we have a sample workbook:
To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed/changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.
The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.
To attach your workbook, click on the New Post button, then scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.
Have a great day,
Stan
stanleydgromjr
Windows Vista Business, Excel 2003 and 2007
If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
Sorry...I think you're going to need to post your code and/or a sample workbook. Thanks!
-GregIf this is helpful, pls click Star icon in lower left corner
I would like them to be moved to the other worksheet and then be deleted from the current pipeline. When they are added to the booked or dnmq workbook, can we have them be automatically placed on the next open row?
Basically if I select Booked then they will move to booked worksheet on the next free row.
If i select DNMQ then they will move to DNMQ worksheet on the next free row.
Hope this helps and thanks for your help!
This would go in your Current worksheet module. If you need the rows on the Current sheet moved up, you'll need additional code.Good luck!Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 4 Then MoveMe Target End Sub Sub MoveMe(rTarget As Range) Dim rCell As Range Dim wsMoveTo As Worksheet Dim rMoveToRow As Range Dim rCopyFrom As Range Dim rCopyTo As Range Dim rItem As Range Dim bEvents As Boolean With Application bEvents = .EnableEvents .EnableEvents = False End With For Each rCell In rTarget Select Case rCell.Text Case "Booked", "DNMQ" Set wsMoveTo = Sheets(rCell.Text) Case Else Exit Sub End Select Set rMoveToRow = wsMoveTo.Cells.Find("Potential", LookIn:=xlValues, LookAt:=xlWhole).End(xlUp).Offset(1) Set rCopyFrom = Range(Cells(rCell.Row, "A"), Cells(rCell.Row, "J")) Set rCopyTo = wsMoveTo.Range(wsMoveTo.Cells(rMoveToRow.Row, "A"), wsMoveTo.Cells(rMoveToRow.Row, "J")) rCopyTo.Formula = rCopyFrom.Formula For Each rItem In rCopyFrom If Not rItem.HasFormula Then rItem.ClearContents Next Next Set wsMoveTo = Nothing Set rMoveToRow = Nothing Set rCopyFrom = Nothing Set rCopyTo = Nothing Application.EnableEvents = bEvents End Sub
-GregIf this is helpful, pls click Star icon in lower left corner
bdf0827,
Thanks for the workbook.
Detach/open workbook Worksheet_Change Event wC colD wB wD bdf0827 - EF790860 - SDG12.xlsm and make changes to the DataValidation cells in worksheet Current in range D7:D26.
Then check the other two worksheets.
If you want to use the macro on another workbook:
Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
2. Select the worksheet in which your code is to run, worksheet Current
3. Right click on the sheet tab and choose View Code, to open the Visual Basic Editor
4. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
5. Press the keys ALT + Q to exit the Editor, and return to Excel
Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) ' stanleydgromjr, 09/03/2011 ' http://www.excelforum.com/excel-programming/790860-move-entire-row-to-another-worksheet-based-on-cell-value.html If Intersect(Target, Range("D7:D26")) Is Nothing Then Exit Sub If Target.Count > 1 Then Exit Sub If Target = "" Then Exit Sub Dim NR As Long With Application .EnableEvents = False .ScreenUpdating = False Select Case Target.Value Case "Booked" NR = Worksheets("Booked").Range("D29").End(xlUp).Offset(1).Row Range("A" & Target.Row & ":J" & Target.Row).Copy Worksheets("Booked").Range("A" & NR) Case "DNMQ" NR = Worksheets("DNMQ").Range("D29").End(xlUp).Offset(1).Row Range("A" & Target.Row & ":J" & Target.Row).Copy Worksheets("DNMQ").Range("A" & NR) End Select .EnableEvents = True .ScreenUpdating = True End With End Sub
Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm
Then make changes to the DataValidation cells in worksheet Current in range D7:D26.
Then check the other two worksheets.
Last edited by stanleydgromjr; 09-03-2011 at 11:03 PM.
Have a great day,
Stan
stanleydgromjr
Windows Vista Business, Excel 2003 and 2007
If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
Rolls data up to fill empty rowPrivate Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 4 And Target.Cells.Count = 1 Then MoveMe Target End Sub Sub MoveMe(rTarget As Range) Dim wsMoveTo As Worksheet Dim rMoveToRow As Range Dim rCopyFrom As Range Dim rCopyTo As Range Dim rItem As Range Dim rMoveUp As Range Dim bEvents As Boolean Dim bScrUpd As Boolean Dim lCalc As Long With Application bEvents = .EnableEvents bScrUpd = False lCalc = .Calculation .EnableEvents = False .ScreenUpdating = False .Calculation = xlCalculationManual End With Select Case rTarget.Text Case "Booked", "DNMQ" Set wsMoveTo = Sheets(rTarget.Text) Case Else Exit Sub End Select Set rMoveToRow = wsMoveTo.Cells.Find("Potential", LookIn:=xlValues, LookAt:=xlWhole).End(xlUp).Offset(1) Set rCopyFrom = Range(Cells(rTarget.Row, "A"), Cells(rTarget.Row, "J")) Set rCopyTo = wsMoveTo.Range(wsMoveTo.Cells(rMoveToRow.Row, "A"), wsMoveTo.Cells(rMoveToRow.Row, "J")) rCopyTo.Formula = rCopyFrom.Formula Set rMoveUp = Range(Cells.Find("Potential", LookIn:=xlValues, _ LookAt:=xlWhole).End(xlUp).Offset(1), rCopyFrom) rMoveUp.Formula = rMoveUp.Offset(1).Formula Set wsMoveTo = Nothing Set rMoveToRow = Nothing Set rCopyFrom = Nothing Set rCopyTo = Nothing With Application .EnableEvents = bEvents .ScreenUpdating = bScrUpd .Calculation = lCalc End With End Sub
Last edited by gjlindn; 09-04-2011 at 12:05 AM.
-GregIf this is helpful, pls click Star icon in lower left corner
I'm trying to figure out how to mark this as solved. I've tried clicking all around.
Formula updates.
-GregIf this is helpful, pls click Star icon in lower left corner
bdf0827,
Per your latest request "after copying the Target.Row, delete the Target.Row".
Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
2. Select the worksheet in which your code is to run, worksheet Current
3. Right click on the sheet tab and choose View Code, to open the Visual Basic Editor
4. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
5. Press the keys ALT + Q to exit the Editor, and return to Excel
Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) ' stanleydgromjr, 09/04/2011 ' Version 2, after copying the Target.Row, delete the Target.Row ' http://www.excelforum.com/excel-programming/790860-move-entire-row-to-another-worksheet-based-on-cell-value.html If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub If Target.Count > 1 Then Exit Sub If Target = "" Then Exit Sub Dim NR As Long With Application .EnableEvents = False .ScreenUpdating = False Select Case Target.Value Case "Booked" NR = Worksheets("Booked").Range("D29").End(xlUp).Offset(1).Row Range("A" & Target.Row & ":J" & Target.Row).Copy Worksheets("Booked").Range("A" & NR) Rows(Target.Row).Delete Case "DNMQ" NR = Worksheets("DNMQ").Range("D29").End(xlUp).Offset(1).Row Range("A" & Target.Row & ":J" & Target.Row).Copy Worksheets("DNMQ").Range("A" & NR) Rows(Target.Row).Delete End Select .EnableEvents = True .ScreenUpdating = True End With End Sub
If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
Have a great day,
Stan
stanleydgromjr
Windows Vista Business, Excel 2003 and 2007
If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks