So every week I have a dump of invoices that go into an excel spreadsheet. What I need to do is have it search the Item Desc based on two critera "cd" and "1" and if a match is found copy the "Quantity" and "Amount" to certain columns and then fill the columns that have "Specific #" with a specific number.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
K |
L |
M |
N |
O |
P |
Q |
R |
S |
T |
U |
V |
W |
X |
Y |
Z |
AA |
AB |
AC |
AD |
AE |
AF |
AG |
AH |
AI |
AJ |
AK |
AL |
AM |
AN |
AO |
AP |
AQ |
AR |
Ignore |
Ignore |
Ignore |
Ignore |
Ignore |
Item Desc |
Quantity |
Amount |
$AV |
Specific # 1 |
Specific # 2 |
Specific # 3 |
#B |
#P |
#CD |
# DVD |
# cass |
# m |
$ CD |
$DVD |
$ cass |
$ m |
Cat #1 |
Cat #2 |
Cat #3 |
Cat #4 |
Cat #5 |
Cat #6 |
Cat #7 |
Cat #8 |
Cat #9 |
Cat #10 |
Cat #11 |
Cat #12 |
Cat #13 |
Cat #14 |
Cat #15 |
Cat #16 |
Specific # 4 |
Specific # 5 |
Ignore |
Specific # 6 |
Specific # 7 |
Specific # 8 |
|
|
|
|
|
cd 1 |
1 |
20 |
20 |
1 |
0 |
1 |
|
|
1 |
|
|
|
20 |
|
|
|
20 |
|
|
|
|
|
|
|
|
|
|
$20 |
|
|
|
|
0 |
0 |
|
0 |
0 |
0 |
|
|
|
|
|
cd 2 |
1 |
15 |
15 |
1 |
0 |
1 |
|
|
1 |
|
|
|
15 |
|
|
|
15 |
|
|
|
|
|
|
|
|
|
|
$15 |
|
|
|
|
0 |
0 |
|
0 |
0 |
0 |
|
|
|
|
|
P 1 |
3 |
30 |
|
3 |
3 |
0 |
|
3 |
|
|
|
|
|
|
|
|
30 |
|
|
|
|
|
|
|
|
|
|
$30 |
|
|
|
|
0 |
0 |
|
0 |
0 |
0 |
|
|
|
|
|
cd 47 |
1 |
100 |
100 |
12 |
2 |
10 |
|
|
1 |
|
|
|
100 |
|
|
|
100 |
|
|
|
|
|
|
|
|
|
|
|
100 |
100 |
|
|
0 |
0 |
|
0 |
0 |
0 |
|
|
|
|
|
HC book #1 |
1 |
20 |
|
1 |
1 |
0 |
1 |
|
|
|
|
|
|
|
|
|
20 |
|
|
|
|
|
|
|
|
20 |
20 |
20 |
|
|
|
|
0 |
0 |
|
0 |
0 |
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
What I want to do is make a database of these item searches to cover hundreds of different items, so it will fill in the entire spreadsheet with the correct data specified for each item.
So something that would do this:
Search "Column F"(Item Desc) Criteria 1 "cd" Criteria 2 "1" or "2"
If Match
then for all matches:
Fill column "J" (Specific #1) with "1"
Fill column "K" (Specific #2) with "0"
Fill column "L" (Specific #3) with "1"
Fill column "AM" (Specific #4) with "0"
Fill column "AN" (Specific #5) with "0"
Fill column "AP" (Specific #6) with "0"
Fill column "AQ" (Specific #7) with "0"
Fill column "AR" (Specific #8) with "0"
Copy Column "H" (Amount) to Column "I" ($AV)
'Copy Column "G" (Quantity) to Column "M" (#B)
'Copy Column "G" (Quantity) to Column "N" (#P)
'Copy Column "G" (Quantity) to Column "O" (#CD)
'Copy Column "G" (Quantity) to Column "P" (#DVD)
'Copy Column "G" (Quantity) to Column "Q" (#cass)
'Copy Column "G" (Quantity) to Column "R" (#m)
'Copy Column "H" (Amount) to Column "S" ($CD)
'Copy Column "H" (Amount) to Column "T" ($DVD)
'Copy Column "H" (Amount) to Column "U" ($cass)
'Copy Column "H" (Amount) to Column "V" ($m)
Copy Column "H" (Amount) to Column "W" (Cat #1)
'Copy Column "H" (Amount) to Column "X" (Cat #2)
'Copy Column "H" (Amount) to Column "Y" (Cat #3)
'Copy Column "H" (Amount) to Column "Z" (Cat #4)
'Copy Column "H" (Amount) to Column "AA" (Cat #5)
'Copy Column "H" (Amount) to Column "AB" (Cat #6)
'Copy Column "H" (Amount) to Column "AC" (Cat #7)
'Copy Column "H" (Amount) to Column "AD" (Cat #8)
'Copy Column "H" (Amount) to Column "AE" (Cat #9)
'Copy Column "H" (Amount) to Column "AF" (Cat #10)
'Copy Column "H" (Amount) to Column "AG" (Cat #11)
Copy Column "H" (Amount) to Column "AH" (Cat #12)
'Copy Column "H" (Amount) to Column "AI" (Cat #13)
'Copy Column "H" (Amount) to Column "AJ" (Cat #14)
'Copy Column "H" (Amount) to Column "AK" (Cat #15)
'Copy Column "H" (Amount) to Column "AL" (Cat #16)
I just need the real code that would actually do this in VBA.
Bookmarks