Copying a cell from one worksheet to another conditionally

misslisa330

New Member
Joined
Feb 11, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi. Please help! In my workbook, I have a worksheet called Request Tracker, where in column F, I have a drop down to select Yes or No. I want it to work where, if I select Yes from the drop down in column F, the info in columns B, D, and E of that same row in gets copied to a different sheet in the same workbook called Publication Tracker, to columns B, E, and F, respectively, and in the next available row. Note: I don't want to copy the whole row from one sheet to the other, just the cells noted, as the two sheets otherwise have different info. (Added images, if that's helpful)

I'm new to VBA and I've tried a few things based on my Google searches, and it's not working. Thanks, in advance!
 

Attachments

  • 1676135919522.png
    1676135919522.png
    27.5 KB · Views: 10
  • 1676135950555.png
    1676135950555.png
    28 KB · Views: 8

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your Requests 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 F.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Column <> 6 Then Exit Sub
    Application.ScreenUpdating = False
    If Target = "Yes" Then
        With Sheets("Publication Tracker")
            .Cells(.Rows.Count, "B").End(xlUp).Offset(1).Value = Target.Offset(, -4).Value
            .Cells(.Rows.Count, "E").End(xlUp).Offset(1).Resize(, 2).Value = Array(Target.Offset(, -2).Value, Target.Offset(, -1).Value)
        End With
    End If
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Actually one other question, please. If I want to also enter the value, Mailbox, in column D along with the fields I'm copying to the Publication Tracker sheet, how do I add that?
 
Upvote 0
Actually one other question, please. If I want to also enter the value, Mailbox, in column D along with the fields I'm copying to the Publication Tracker sheet, how do I add that?
Oh, I figured it out... Not to worry. Thanks, again, for your help!!
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,888
Members
449,097
Latest member
dbomb1414

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