This is the destination sheet. When you hit refresh, it runs the macro but nothing pastes.
New Vendors by State.xlsm |
---|
|
---|
| A | B | C | D | E | F | G | H | I | J | K | L | M |
---|
1 | | | | | | | | | | | | | |
---|
2 | | | | | | | | | | | | | |
---|
3 | | | | | | | | | | | | | |
---|
4 | | | | | | | | | | | | | |
---|
5 | | | | | | | | | | | | | |
---|
6 | | | | | | | | | | | | | |
---|
7 | Source | Source City | Zip | Date | POC | Company | Phone | Call Result | Trailer/Set up | Pricing | Insurance? | Notes | Sourcer |
---|
|
---|
Here is the code for the macro
Sub CopyOnboarded()
Dim TransIDField As Range
Dim TransIDCell As Range
Dim ATransWS As Worksheet
Dim HTransWS As Worksheet
Set ATransWS = Worksheets("CA")
Set TransIDField = ATransWS.Range("A2", ATransWS.Range("A2").End(xlDown))
Set HTransWS = Worksheets("Onboarded")
' Find last row with data in column A on HTransWS sheet
lr = HTransWS.Cells(Rows.Count, "A").End(xlUp).Row
' Delete data from row 8 down
If lr >= 8 Then
HTransWS.Range("A8:A" & lr).EntireRow.Delete
End If
For Each TransIDCell In TransIDField
If TransIDCell.Interior.Color = RGB(198, 239, 206) Then
TransIDCell.Resize(1, 12).Copy Destination:= _
HTransWS.Range("A1").Offset(HTransWS.Rows.Count - 1, 0).End(xlUp).Offset(1, 0)
End If
Next TransIDCell
HTransWS.Columns.AutoFit
End Sub