Hello,
This is most likely simpler that what I am killing myself over, so thanks in advanced for assisting the code challenged.
It is a fixed Range is from Row 3 to 1002, but need to incroment the Column by 2, below is what I have but getting error on the 'Set CheckColumn...", which I am just trying to rationalize the Range("A4:A" & Range("A504") to the Cells method.
EDIT: added code tags - Moderator
This is most likely simpler that what I am killing myself over, so thanks in advanced for assisting the code challenged.
It is a fixed Range is from Row 3 to 1002, but need to incroment the Column by 2, below is what I have but getting error on the 'Set CheckColumn...", which I am just trying to rationalize the Range("A4:A" & Range("A504") to the Cells method.
Code:
Sub FindProdandSam()
Dim CheckColumn As Range, ProductList As Range, SampleList As Range
Set ProductList = Sheets("Products").Range("A4:A" & Range("A504").End(xlUp).Row)
Set SampleList = Sheets("Products").Range("I4:I" & Range("I104").End(xlUp).Row)
i = 10
For i = i To 200
ThisCol = i + 2
Set CheckColumn = Sheets("Contact").Cells(3, ThisCol) & Cells(3, 1002).End(xlUp).Row
SummaryRow = 3
'Check for matches then get Quanity-------------------------------------------------
For Each SampleNum In SampleList
GetRow = 2
QtySample = 0
SummaryRow = SummaryRow + 1
For Each FindSample In CheckColumn
GetRow = GetRow + 1 'This is the row counter to get Column B, Row X
If SampleNum = FindSample Then
GetQty = Sheets("Contact").Range("K" & GetRow)
QtySample = QtySample + GetQty
Cells(SummaryRow, "O") = QtySample
End If
Next FindSample
Next SampleNum
Next i
End Sub
EDIT: added code tags - Moderator