D
Dan
I am trying to find item codes that have different suffixes on the for
example color.
Data
A B C D E
F
ITEMS TO FIND ITEMS ITEMS FOUND VARIATIONS
ACT 1111 ACT 1234 ACT 1237 ACT
1237-BK
ACT 1235 ACT 1235 ACT 1237 ACT
1237-BR
ACT 1235-GR ACT 1236 ACT 1237 ACT 1237-GR
ACT 1237 ACT 1237 ACT 1237 ACT
1237-WT
ACT 1239 ACT 1237-BK
ACT 1237-BR
ACT 1237-GR
ACT 1237-WT
ACT 1238
ACT 1239
What I am trying to do is find the items in column A that exist in column C
that have suffixes and put the item from A in column E and its corisponding
item (with suffix) in column F.
Here is my code:
Sub Run_Report()
Dim x As Long
Dim Item As Variant
Range("a2").Select
x = 2
While Cells(x, 1) <> ""
Item = Cells(x, 1)
Find_Variations Item
x = x + 1
Wend
End Sub
Sub Find_Variations(Item As Variant)
Dim y, z As Long
y = 2 ' track where we are in column C
z = 2 ' track where we are in columns E & F
While Cells(y, 3) <> "" 'Look for Item in column C
If Item = Left(Cells(y, 3), Len(Item)) Then
If Item <> Cells(y, 3) Then ' we don't want to find exact matchs
Cells(z, 5) = Item
Cells(z, 6) = Cells(y, 3)
z = z + 1
End If
End If
y = y + 1
Wend
End Sub
The problem is I have 3,000 items in column A and 40,000 items in column C.
So the code takes a long time. I wanted to use VLOOKUP but it will not find
all variations. Is there any other options? Any ideas on speeding up the
code?
By the way the example above Columns E and F are the actual result that I
want.
DG
example color.
Data
A B C D E
F
ITEMS TO FIND ITEMS ITEMS FOUND VARIATIONS
ACT 1111 ACT 1234 ACT 1237 ACT
1237-BK
ACT 1235 ACT 1235 ACT 1237 ACT
1237-BR
ACT 1235-GR ACT 1236 ACT 1237 ACT 1237-GR
ACT 1237 ACT 1237 ACT 1237 ACT
1237-WT
ACT 1239 ACT 1237-BK
ACT 1237-BR
ACT 1237-GR
ACT 1237-WT
ACT 1238
ACT 1239
What I am trying to do is find the items in column A that exist in column C
that have suffixes and put the item from A in column E and its corisponding
item (with suffix) in column F.
Here is my code:
Sub Run_Report()
Dim x As Long
Dim Item As Variant
Range("a2").Select
x = 2
While Cells(x, 1) <> ""
Item = Cells(x, 1)
Find_Variations Item
x = x + 1
Wend
End Sub
Sub Find_Variations(Item As Variant)
Dim y, z As Long
y = 2 ' track where we are in column C
z = 2 ' track where we are in columns E & F
While Cells(y, 3) <> "" 'Look for Item in column C
If Item = Left(Cells(y, 3), Len(Item)) Then
If Item <> Cells(y, 3) Then ' we don't want to find exact matchs
Cells(z, 5) = Item
Cells(z, 6) = Cells(y, 3)
z = z + 1
End If
End If
y = y + 1
Wend
End Sub
The problem is I have 3,000 items in column A and 40,000 items in column C.
So the code takes a long time. I wanted to use VLOOKUP but it will not find
all variations. Is there any other options? Any ideas on speeding up the
code?
By the way the example above Columns E and F are the actual result that I
want.
DG