I have some code, that when run from the current workbook (a template), it opens a different predetermined workbook (Sales Log), performs a find in column "A" in the Sale Log to determine the corresponding row of the item # from the template, and places certain results in the Sales Log in that row for a specific column.
Example: In the template I have item # 24538. When I run the code, it opens the Sales Log, locates the row where item # 24538 (from the template) is located, and adjusts the cell in the 6th column for that corresponding row in the Sales Log.
Here is the code:
However, now I need to add an additional layer of criteria to the Find, so that not only does it find the row where the item number is located, but also the corresponding type.
I could have the same item # multiple times in the column "A", but in column "B" I have several different types, such as winter, summer, fall, spring, etc.
Example: I could have item # 12458 twice, one with Summer and one with Fall.
When I run my code, I need it to find the row where with the item # and the Type of Fall, then make the update to the appropriate row.
Any ideas?
-Spydey
Example: In the template I have item # 24538. When I run the code, it opens the Sales Log, locates the row where item # 24538 (from the template) is located, and adjusts the cell in the 6th column for that corresponding row in the Sales Log.
Here is the code:
Code:
Public Sub Pending()
Dim FindRowNumber, Item As Long
Dim wbT, wbL As Workbook
Dim wsT, wsL As Worksheet
Set wbT = ThisWorkbook
Set wsT = wbT.Worksheets(1)
Set wbL = Workbooks("Sales Log.xlsm")
Set wsL = wbL.Worksheets("Assigned")
With wsT
Item = .Range("Item").Value
End With
Application.ScreenUpdating = False
With wsL
On Error Resume Next
.ShowAllData
Set FindRow = .Range("A:A").Find(What:=Item, LookIn:=xlValues, LookAt:=xlWhole)
End With
FindRowNumber = FindRow.Row
wsL.Cells(FindRowNumber, 1).Offset(0, 7).Value = "PENDING"
wbL.Save
Application.ScreenUpdating = True
End Sub
However, now I need to add an additional layer of criteria to the Find, so that not only does it find the row where the item number is located, but also the corresponding type.
I could have the same item # multiple times in the column "A", but in column "B" I have several different types, such as winter, summer, fall, spring, etc.
Example: I could have item # 12458 twice, one with Summer and one with Fall.
When I run my code, I need it to find the row where with the item # and the Type of Fall, then make the update to the appropriate row.
Any ideas?
-Spydey