Need to copy certain cells to different worksheet based on cell value

jordanja72

New Member
Joined
Aug 2, 2013
Messages
2
I have a spreadsheet in Excel 2010, that I am wanting to take certain cells in a row and copy them to another worksheet when a certain value is entered into a specific cell in the same row.

For example: In Worksheet A, in cell A2, if a "X" is entered, I want cell A5, A7 and A13-17 to be copied to Worksheet B. In Worksheet B, they should be copied to the next available row, but I need them copied to specific cells (not the same as in Worksheet A- i.e: cell A5 would need to copy to cell 2 in Worksheet B; A7 to cell 4 and A13-17 to 10-14)

I have some VBA that does something similar; however, it copies the entire row. For the above, I need only specific cells AND they won't match same cells in Worksheet B.

Thank you in advance, please let me know if there are any specific questions
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Not sure if I provided enough information. Here is what I have been able to get to work (to copy entire row):
Code:
 Sub Testing_Issue(ByVal Target As Range)
'Disable events so code doesn't re-fire when row is deleted
Application.EnableEvents = False
'Was the change made to Column T?
  If Target.Column = 20 Then
'If yes, does the Target read "Y"?
   If Target = "Y" Then
'If Y, determine next empty row in Sheet "TEST"
     nxtRw = Sheets("TEST").Range("A" & Rows.Count).End(xlUp).Row + 1
   
'Copy the row from the Open worksheet and move to the TEST worksheet
      Target.EntireRow.Copy Destination:=Sheets("TEST").Range("A" & nxtRw)
   Else
    MsgBox ("That is not a valid entry")
   End If
  End If
'Re-enable Events
  Application.EnableEvents = True
End Sub

I tried using:
Code:
Target.Range("A13").Copy Destination:=Sheets("TEST").Range("A5 & nxtRw")
Target.Range("B13").Copy Destination:=Sheets("TEST").Range("C5 & nxtRw")
Target.Range("I13:J13").Copy Destination:=Sheets("TEST").Range("E5 & nxtRw")

instead of the entire row part, but does not work. I would greatly appreciate some advice, as I really need to get this working right. Please let me know if something is not clear.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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