R
Rpettis31
I know there is probably a better way of doing this than what I have done and
I need some help. I am trying to compare values on one workbook to another
and update the main workbook. It seemed to work and then today someone
notice that some of the values are duplicated. For example the value for
item a was looked up but then the next 2 rows have the same values. I am
assuming it is how I have approached the code.
Workbooks.Open Filename:= _
"G:\POS Analysis\Wal-Mart POS Reports\ITEMVENDORCROSS.XLS"
For z = 2 To 800
CurrItem = Cells(z, 1)
Workbooks("ITEMVENDORCROSS.XLS").Activate
Sheets("CrossRef").Select
For xx = 1 To 4000
If Cells(xx, 2) = CurrItem Then
OurItem = Cells(xx, 3)
End If
Next xx
Workbooks("POS Raw Data WMUS Template.xls").Activate
Sheets("Sheet1").Select
Cells(z, 3) = OurItem
Next z
' Close Cross Reference file
Application.CutCopyMode = False
Workbooks("ITEMVENDORCROSS.XLS").Close savechanges:=False
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
I need some help. I am trying to compare values on one workbook to another
and update the main workbook. It seemed to work and then today someone
notice that some of the values are duplicated. For example the value for
item a was looked up but then the next 2 rows have the same values. I am
assuming it is how I have approached the code.
Workbooks.Open Filename:= _
"G:\POS Analysis\Wal-Mart POS Reports\ITEMVENDORCROSS.XLS"
For z = 2 To 800
CurrItem = Cells(z, 1)
Workbooks("ITEMVENDORCROSS.XLS").Activate
Sheets("CrossRef").Select
For xx = 1 To 4000
If Cells(xx, 2) = CurrItem Then
OurItem = Cells(xx, 3)
End If
Next xx
Workbooks("POS Raw Data WMUS Template.xls").Activate
Sheets("Sheet1").Select
Cells(z, 3) = OurItem
Next z
' Close Cross Reference file
Application.CutCopyMode = False
Workbooks("ITEMVENDORCROSS.XLS").Close savechanges:=False
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub