Macro for Button: If Cell = Name then Copy to Another Spreadsheet

koolgeex

New Member
Joined
May 2, 2012
Messages
45
Something like:
In spreadsheet "Complete Backlog", if a cell in Column K = "Open" AND the cell in Column G of the same row = "Snodgress" THEN copy cells A?:J? and paste into cells A?:J? of the "Snodgress" sheet. Of course skipping to the next available row and also the content should not repeat itself.

I have this code so far but it gives me an error about merged cells. I think that's because i have miscellaneous text outside of the designated "paste area". So the whole row shouldn't be pasted, just the specific range. Any suggestions?

Code:
Sub copy_director_snod()
Dim i As Long, lrow As Long, lastrow As Long
With Worksheets("Complete Backlog")
lrow = .Range("a" & .Rows.Count).End(xlUp).Row
For i = 2 To lrow
If .Range("g" & i).Value = "Snodgress" Then
lastrow = Worksheets("Snodgress").Range("A" & Rows.Count).End(xlUp).Row
.Range("A" & i & ":L" & i).Copy Worksheets("Snodgress").Range("A" & lastrow + 1)
a = a + 1
End If
Next i
End With
End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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