Pasting Entire Row in New Workbook

laku0006

New Member
Joined
May 13, 2010
Messages
5
Hello Am trying to create a macro which will paste entire row if column F is populated with "Pending Research" and "Research Complete" I have a macro which works in same workbook. But am trying to do it in a way that it pastes in newworkbook which am naming as "Master". Below is code which works for same workbook.

Private Sub WorkSheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub

If Target.Column <> 6 Then Exit Sub
If Target = "Pending Research" Or Target = "Complete Research" Then
Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(, 6) = Target.Offset(, -5).Resize(, 9).Value
End If
End Sub

Please help.

Thanks
Lav... <!-- / message -->
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Is the other workbook open?

If it is all you should need to do is add a reference to it.
Code:
Set wbDst = Workbooks("NameOfOtherWorkbook.xls") ' change name/extension as required
....
wbDst.Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(, 6) = Target.Offset(, -5).Resize(, 9).Value
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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