How to move a row to the next sheet when I input a certain value in a cell within that row?

jdlerry

New Member
Joined
Apr 6, 2021
Messages
32
Office Version
  1. 2016
Platform
  1. Windows
NEED HELP PLEASE. Thank you! I actually asked the same question before which is VBA codes. If someone can help me with the VBA code please.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Be more precise:
Where do you want to input value?
By move, you mean delete the entire row (including your input data) to the next sheet on same row or start moving from row 1 and so on?
 
Upvote 0
Be more precise:
Where do you want to input value?
By move, you mean delete the entire row (including your input data) to the next sheet on same row or start moving from row 1 and so on?
Thank you for your reply. I really appreciate it. If you can take a look at the file that I saved here on Dropbox. Basically I will put my data in Masterlist tab and under ACTION TAKEN/ TO DO, whenever I select an action, it should move to another tab. You may see the INSTRUCTION tab for reference https://www.dropbox.com/scl/fi/o1l7v9vxhgvw2871it1jl/eMedical-Tracker-new.xlsx?dl=0&rlkey=rkmrvmi86eswnf1iegsyxp2cf
 
Upvote 0
Be more precise:
Where do you want to input value?
By move, you mean delete the entire row (including your input data) to the next sheet on same row or start moving from row 1 and so on?
The entire row should move to the next tab when I select a data from ACTION TAKEN/ TO DO. For example in this screenshot, the entire row 3 (DATE until SERVICE TICKET #) should also move when I change the ACTION TAKEN/TO DO. Hope I did not confuse you. Thank you
 

Attachments

  • Capture.PNG
    Capture.PNG
    16.8 KB · Views: 5
Upvote 0
Be more precise:
Where do you want to input value?
By move, you mean delete the entire row (including your input data) to the next sheet on same row or start moving from row 1 and so on?
and yes, delete the entire row and move to another tab
 
Upvote 0
The entire row should move to the next tab when I select a data from ACTION TAKEN/ TO DO. For example in this screenshot, the entire row 3 (DATE until SERVICE TICKET #) should also move when I change the ACTION TAKEN/TO DO. Hope I did not confuse you. Thank you
It should be row 4 rather. Not row 3 that will move. Thank you
 
Upvote 0
Put this code under Masterlist module to auto trigger when selection is made. I'm just guessing the destination. You can modify to your need. Easy to understand
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strAction As String
Dim rngData As Range
Dim wsDest As Worksheet

Application.EnableEvents = False
On Error Resume Next

If Not Intersect(Range("N4"), Target) Is Nothing Then
    Set rngData = ActiveSheet.Range("A4", "V4")
    Select Case Target
        Case "FOR CASERVICEDESK"
            
        Case "TRIGGERED IN EDP"
        
        Case "REFER TO CON OFF"
            Set wsDest = Sheets("CON OFF")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "TERM 1"
            Set wsDest = Sheets("TERM 1")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "EMAIL SENT TO CST"
            Set wsDest = Sheets("EMAIL SENT TO CST")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "FF-UP EMAIL SENT (CST)"
            Set wsDest = Sheets("FF-UP EMAIL SENT (CST)")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "VERIFY WITH SLEC"
            Set wsDest = Sheets("VERIFY WITH SLEC")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "RESOLVED"
            Set wsDest = Sheets("RESOLVED")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "OTHERS, SEE REMARKS"
            Set wsDest = Sheets("OTHERS")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
    End Select
End If

On Error GoTo 0
Application.EnableEvents = True

End Sub

Function rowNext(ws As Worksheet) As Long
rowNext = ws.Cells(Rows.Count, "A").End(xlUp).Row + 1
End Function
 
Upvote 0
Put this code under Masterlist module to auto trigger when selection is made. I'm just guessing the destination. You can modify to your need. Easy to understand
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strAction As String
Dim rngData As Range
Dim wsDest As Worksheet

Application.EnableEvents = False
On Error Resume Next

If Not Intersect(Range("N4"), Target) Is Nothing Then
    Set rngData = ActiveSheet.Range("A4", "V4")
    Select Case Target
        Case "FOR CASERVICEDESK"
           
        Case "TRIGGERED IN EDP"
       
        Case "REFER TO CON OFF"
            Set wsDest = Sheets("CON OFF")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "TERM 1"
            Set wsDest = Sheets("TERM 1")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "EMAIL SENT TO CST"
            Set wsDest = Sheets("EMAIL SENT TO CST")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "FF-UP EMAIL SENT (CST)"
            Set wsDest = Sheets("FF-UP EMAIL SENT (CST)")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "VERIFY WITH SLEC"
            Set wsDest = Sheets("VERIFY WITH SLEC")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "RESOLVED"
            Set wsDest = Sheets("RESOLVED")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
        Case "OTHERS, SEE REMARKS"
            Set wsDest = Sheets("OTHERS")
            rngData.Copy
            wsDest.Range("A" & rowNext(wsDest)).PasteSpecial (xlPasteValues)
            rngData.ClearContents
    End Select
End If

On Error GoTo 0
Application.EnableEvents = True

End Sub

Function rowNext(ws As Worksheet) As Long
rowNext = ws.Cells(Rows.Count, "A").End(xlUp).Row + 1
End Function
Not working :(
 
Upvote 0
It is an event trigger code. See image below. You need to double-click the Masterlist worksheet and paste the code there. No need to Insert Module or anything
 

Attachments

  • VB Editor.jpg
    VB Editor.jpg
    59.9 KB · Views: 4
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,732
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top