Move row from one sheet to another sheet based on dropdown option selected

becstc

New Member
Joined
Oct 5, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi there,
I have nil experience with visual basic, and have been attempting to use VBA code sourced from various forums to create a macro to perform this function without success (various errors I don't know the meaning of!)
I have a worksheet titled "CMB OT - Active referrals" which has headings in row 1 and 15 columns worth of data. Column O (or 15) has dropdown options of Yes or No.
I have another worksheet titled "CMB OT - Inactive referrals". I would like to create a macro so that when Yes is selected in Column O in the "CMB OT - Active referrals" sheet, I can press a button which is linked to a macro which moves the entire row of data from the "CMB OT - Active referrals" to the "CMB OT - Inactive referrals" sheet. I would like the row from which the data has been moved from to be deleted and when moved the data is added to the next blank row in the receiving sheet.
I am happy to upload the entire worksheet if required, but am not sure if this is possible on this forum.
Thanks for any suggestions/advice you can offer.
Warm regards,
Bec (form down under!)
 

Attachments

  • Capture.PNG
    Capture.PNG
    12.4 KB · Views: 88

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your "CMB OT - Active referrals" sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make a selection in column O.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("O:O")) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    If Target = "Yes" Then
        With Sheets("CMB OT - Inactive referrals")
            Target.EntireRow.Copy .Cells(.Rows.Count, "A").End(xlUp).Offset(1)
            Target.EntireRow.Delete
        End With
    End If
    Application.EnableEvents = True
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,839
Members
449,051
Latest member
excelquestion515

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