Thank you to both of you. Winon, I'm surprised i never thought of putting them horizontally. However, I figured out how to do it. But I'm still stuck on one part of this problem and that's when it comes to making sure duplicates aren't passed to the Dashboard. Right now, it's just overwriting the first row (.Offset(1, 0)). I would like it to go to the last available cell instead.
I was thinking I could just delete the entire range and re-calculate, but that seems unecessary. Here's the code I have:
Option Explicit
Sub purchPull()
Dim Dashboard As Worksheet
Dim Purchasing As Worksheet
Dim PM As Range, D As Range, Rng As Range
Dim purchName As Range
Dim lastRow As Long
Dim firstRow As Long
Set Purchasing = Worksheets("Purchasing")
Set Dashboard = Worksheets("Dashboard")
firstRow = Dashboard.Range("PurchaseStart").Row + Dashboard.Range("PurchaseStart").Rows.Count
lastRow = Dashboard.Range("PurchaseStart").Cells(1, 1).End(xlDown).Row
MsgBox lastRow
MsgBox firstRow
' Go through each Item in Purchasing and check to see if it's anywhere within the named range "PurchaseStart"
' In this case it should be "A8:A9" - as there is nothing in the dasboard yet
For Each PM In Purchasing.Range(Purchasing.Cells(2, 1), Purchasing.Cells(Purchasing.Rows.Count, 1).End(xlUp))
With Dashboard.Range("PurchaseStart", Dashboard.Cells(Dashboard.Rows.Count, 1))
Set Rng = .Find(What:=PM.Offset(0, 0), _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
' Do nothing, as we don't want duplicates
Else
' From the start of the named range, transfer data over
' Rows(firstRow & ":" & lastRow).EntireRow.Delete
With Dashboard.Cells(lastRow, 1).End(xlUp)
.Offset(1, 0) = PM.Offset(0, 0) ' Order Number
.Offset(1, 1) = PM.Offset(0, 1) ' SKU
.Offset(1, 2) = PM.Offset(0, 2) ' Qty
.Offset(1, 3) = PM.Offset(0, 3) ' Date
.Offset(2, 1).EntireRow.Insert
End With
End If
End With
Next
End Sub
Bookmarks