Copy Specific Cells to another Worksheet When Condition Met

iamwickid

New Member
Joined
Apr 27, 2018
Messages
4
I am looking for a way to modify this current VBA code I have working. What it is currently doing is once anything in column 7 is "yes" it will copy the entire row to the next available row of another sheet titled "Error Log".
However what I want it to do is only copy "cell A, E and F" from the same row that the "yes" has been met. My current code is below. Help is greatly appreciated!


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 Then
If Target = "Yes" Then
Application.EnableEvents = False
nxtRow = Sheets("Error Log").Range("A" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("Error Log").Range("A" & nxtRow)
End If
End If
Application.EnableEvents = True
End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi & welcome to the board.
Try
Code:
Intersect(Target.EntireRow, Range("A:A,E:F")).Copy _
Destination:=Sheets("Error Log").Range("A" & nxtRow)
 
Upvote 0
Cross posted https://www.ozgrid.com/forum/forum/...cells-to-another-worksheet-when-condition-met

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Cross posted https://www.ozgrid.com/forum/forum/...cells-to-another-worksheet-when-condition-met

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.


Thanks for the info.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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