Forum Discussion
LearningFurther
Mar 20, 2023Copper Contributor
Formula Help
Excel Sheet 2: Column D are the different part numbers we offer. Column E is the quantity ordered on a specific Purchase order. Column H is the quantity shipped from that specific purchase order. ...
LearningFurther
Mar 29, 2023Copper Contributor
Not sure if this matter also, but the range will go down to about 5,000 line items
Thank you for all your help!!
LearningFurther
Mar 29, 2023Copper Contributor
This formula seems to "semi-work"
It is not returning all the products even though they are on both sheets
Once again I appreciate all your help.
Maybe other tweaks need to be made?
Private Sub CommandButton1_Click()
End Sub
Sub stock()
Dim i, j As Long
Dim sum As Long
For j = 2 To 3000
For i = 2 To 1000
sum = Application.WorksheetFunction.SumIf(Range(Cells(2, 4), Cells(i, 4)), Sheets("Sheet1").Cells(j, 1).Value, Range(Cells(2, 11), Cells(i, 11)))
If sum > Sheets("Sheet1").Cells(j, 2).Value Then
Sheets("Sheet1").Cells(j, 3).Value = Cells(i, 9).Value
Exit For
Else
End If
Next i
Next j
End Sub