1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333
| Public Function ExisteFichier(S As String) As Boolean
Dim tatiak As Object
Set tatiak = CreateObject("Scripting.FileSystemObject")
ExisteFichier = tatiak.FileExists(S)
End Function
Sub etape2()
Dim i As Integer 'balayge du tableau _ trier
i = 2
Dim NG As Integer 'nb item Natural Garden
Dim LT As Integer 'nb item Le Terroir
Dim TR As Integer 'nb item Terrazza
Dim BP As Integer 'nb item Blue Pumpkin
Dim AN As Integer 'nb item Annam
Dim LM As Integer 'nb item Le Marche
Dim RM As Integer 'nb item Royal Mart
Dim TH As Integer 'nb item Thai Huot
Dim BY As Integer 'nb item Bayon
Dim LSH As Integer 'nb item LSH
Dim LKD As Integer 'nb item Lucky Drink
Dim LKM As Integer 'nb item Lucky Market
Dim WH As Integer 'nb item Warehouse
Dim LVC As Integer 'nb item La Vie Claire
Dim KY As Integer 'nb item Kayser
Dim BOD As Integer 'nb item Bodia
Dim UC As Integer 'nb item U Care
Dim AUS As Integer 'nb item Auskhmer
Dim LV As Integer 'nb item Le Votre
Dim BF As Integer 'nb item Bassac Farm
Dim AY As Integer 'nb item Addy Yogurt
Dim GH As Integer 'nb item Goodhill
Dim FCF As Integer 'nb item Francam Foods
Dim RC As Integer 'nb item Royal Canin
Dim MK As Integer 'nb item Market
Dim AM As Integer 'nb item Angkor Market
Dim ANI As Integer 'nb item Animal Mama
Dim YR As Integer 'nb item Yves Rocher
Dim NV As Integer 'nb item Navetco
Dim PL As Integer 'nb item Pelican
Dim MU As Integer 'nb item Mu
Dim CF As Integer 'nb item Confirel
Dim VMT As Integer 'nb item Vimean Tip
Dim MH As Integer 'nb item MH
Dim CA As Integer 'nb item Celliers d'Asie
Dim OS As Integer 'nb item Ostra
Dim BON As Integer 'nb item Bonbon
Dim DS As Integer 'nb item DS
Dim HGD As Integer 'nb item Haagen Dazs
Dim SO As Integer 'nb item Stock Office
Dim BS As Integer 'nb item Baby Shop
Dim CM As Integer 'nb item Chip Mong
Dim LG As Integer 'nb item Legrand
Dim MF As Integer 'nb item Mao Fishmonger
Dim DM As Integer 'nb item Dan Meat
Dim DAI As Integer 'nb item DailyMarche
Dim AR As Integer 'nb item Arthemis
Dim BIO As Integer 'nb item Baby Bio
Dim MDE As Integer 'nb item Maison d'Europe
Dim SV As Integer 'nb item Sonavith
Dim IND As Integer 'nb item Indoguna
Dim CFS As Integer 'nb item Cambodia Food Service
Dim BLD As Integer 'nb item Blends
Dim LP As Integer 'nb item La Plantation
Dim IG As Integer 'nb item Italian Gourmet
'Dim X As Integer ' Pour ajouter un fournisseur avec sous total
Do While ActiveSheet.Cells(i, 8).Value <> "" 'initialise NG, LT, TR...
If Cells(i, 13).Value = "Natural Garden" Then
NG = NG + 1
End If
If Cells(i, 13).Value = "Market" Then
MK = MK + 1
End If
If Cells(i, 13).Value = "Le Terroir" Then
LT = LT + 1
End If
If Cells(i, 13).Value = "Terrazza" Then
TR = TR + 1
End If
If Cells(i, 13).Value = "Annam" Then
AN = AN + 1
End If
If Cells(i, 13).Value = "Blue Pumpkin" Then
BP = BP + 1
End If
If Cells(i, 13).Value = "Le Marche" Then
LM = LM + 1
End If
If Cells(i, 13).Value = "Royal Mart" Then
RM = RM + 1
End If
If Cells(i, 13).Value = "Thai Huot" Then
TH = TH + 1
End If
If Cells(i, 13).Value = "Bayon" Then
BY = BY + 1
End If
If Cells(i, 13).Value = "LSH" Then
LSH = LSH + 1
End If
If Cells(i, 13).Value = "Lucky Drink" Then
LKD = LKD + 1
End If
If Cells(i, 13).Value = "Lucky Market" Then
LKM = LKM + 1
End If
If Cells(i, 13).Value = "Warehouse" Then
WH = WH + 1
End If
If Cells(i, 13).Value = "La Vie Claire" Then
LVC = LVC + 1
End If
If Cells(i, 13).Value = "Kayser" Then
KY = KY + 1
End If
If Cells(i, 13).Value = "U Care" Then
UC = UC + 1
End If
If Cells(i, 13).Value = "Bodia" Then
BOD = BOD + 1
End If
If Cells(i, 13).Value = "Auskhmer" Then
AUS = AUS + 1
End If
If Cells(i, 13).Value = "Le Votre" Then
LV = LV + 1
End If
If Cells(i, 13).Value = "Bassac Farm" Then
BF = BF + 1
End If
If Cells(i, 13).Value = "Addy Yogurt" Then
AY = AY + 1
End If
If Cells(i, 13).Value = "Goodhill" Then
GH = GH + 1
End If
If Cells(i, 13).Value = "Francam Foods" Then
FCF = FCF + 1
End If
If Cells(i, 13).Value = "Angkor Market" Then
AM = AM + 1
End If
If Cells(i, 13).Value = "Animal Mama" Then
ANI = ANI + 1
End If
If Cells(i, 13).Value = "Yves Rocher" Then
YR = YR + 1
End If
If Cells(i, 13).Value = "Royal Canin" Then
RC = RC + 1
End If
If Cells(i, 13).Value = "Navetco" Then
NV = NV + 1
End If
If Cells(i, 13).Value = "Pelican" Then
PL = PL + 1
End If
If Cells(i, 13).Value = "Mu" Then
MU = MU + 1
End If
If Cells(i, 13).Value = "Confirel" Then
CF = CF + 1
End If
If Cells(i, 13).Value = "Vimean Tip" Then
VMT = VMT + 1
End If
If Cells(i, 13).Value = "MH" Then
MH = MH + 1
End If
If Cells(i, 13).Value = "Celliers d'Asie" Then
CA = CA + 1
End If
If Cells(i, 13).Value = "Ostra" Then
OS = OS + 1
End If
If Cells(i, 13).Value = "Bonbon" Then
BON = BON + 1
End If
If Cells(i, 13).Value = "DS" Then
DS = DS + 1
End If
If Cells(i, 13).Value = "Haagen Dazs" Then
HGD = HGD + 1
End If
If Cells(i, 13).Value = "Stock Office" Then
SO = SO + 1
End If
If Cells(i, 13).Value = "Baby Shop" Then
BS = BS + 1
End If
If Cells(i, 13).Value = "Chip Mong" Then
CM = CM + 1
End If
If Cells(i, 13).Value = "Legrand" Then
LG = LG + 1
End If
If Cells(i, 13).Value = "Mao Fishmonger" Then
MF = MF + 1
End If
If Cells(i, 13).Value = "Dan Meat" Then
DM = DM + 1
End If
If Cells(i, 13).Value = "DailyMarche" Then
DAI = DAI + 1
End If
If Cells(i, 13).Value = "Arthemis" Then
AR = AR + 1
End If
If Cells(i, 13).Value = "Baby Bio" Then
BIO = BIO + 1
End If
If Cells(i, 13).Value = "Maison d'Europe" Then
MDE = MDE + 1
End If
If Cells(i, 13).Value = "Sonavith" Then
SV = SV + 1
End If
If Cells(i, 13).Value = "Indoguna" Then
IND = IND + 1
End If
If Cells(i, 13).Value = "Cambodia Food Service" Then
CFS = CFS + 1
End If
If Cells(i, 13).Value = "Blends" Then
BLD = BLD + 1
End If
If Cells(i, 13).Value = "La Plantation" Then
LP = LP + 1
End If
If Cells(i, 13).Value = "Italian Gourmet" Then
IG = IG + 1
End If
'If Cells(i, 13).Value = "Nom Fournisseur X" Then
'X = X + 1
'End If
i = i + 1
Loop
i = 2 'r_initialise la variable de balyage du tableau _ trier
Dim j As Integer 'initialise la variable de balayage du tableau ou on recopie les produits
j = 5
Dim TotalNG As Double
If NG <> 0 Then 'recopie les info du tableau _ trier dans le tableau tri_
j = j + 1
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Natural Garden"
j = j + 1
Do While NG > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Natural Garden" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
NG = NG - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes NG
Cells(j, 5) = "Total NG"
Cells(j, 6).Font.Bold = True
TotalNG = Application.WorksheetFunction.Sum(Range(Cells(7, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalNG
End If
Dim TotalMK As Double
If MK <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Market"
j = j + 1
Dim jDebutMK As Integer
jDebutMK = j
Do While MK > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Market" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
MK = MK - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total MK"
Cells(j, 6).Font.Bold = True
TotalMK = Application.WorksheetFunction.Sum(Range(Cells(jDebutMK, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalMK
End If
Dim TotalLT As Double
If LT <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Le Terroir"
j = j + 1
Dim jD_butLT As Integer 'pour calculer le sous total LT on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutLT = j
Do While LT > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Le Terroir" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LT = LT - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes LT
Cells(j, 5) = "Total LT"
Cells(j, 6).Font.Bold = True
TotalLT = Application.WorksheetFunction.Sum(Range(Cells(jDebutLT, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLT
End If
Dim TotalLV As Double
If LV <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Le Votre"
j = j + 1
Dim jDebutLV As Integer 'pour calculer le sous total BP on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutLV = j
Do While LV > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Le Votre" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LV = LV - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes BP
Cells(j, 5) = "Total LV"
Cells(j, 6).Font.Bold = True
TotalLV = Application.WorksheetFunction.Sum(Range(Cells(jDebutLV, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLV
End If
Dim TotalBF As Double
If BF <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Bassac Farm"
j = j + 1
Dim jDebutBF As Integer 'pour calculer le sous total BP on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutBF = j
Do While BF > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Bassac Farm" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BF = BF - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes BP
Cells(j, 5) = "Total BF"
Cells(j, 6).Font.Bold = True
TotalBF = Application.WorksheetFunction.Sum(Range(Cells(jDebutBF, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBF
End If
Dim TotalPL As Double
If PL <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Pelican"
j = j + 1
Dim jDebutPL As Integer 'pour calculer le sous total BP on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutPL = j
Do While PL > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Pelican" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
PL = PL - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes BP
Cells(j, 5) = "Total PL"
Cells(j, 6).Font.Bold = True
TotalPL = Application.WorksheetFunction.Sum(Range(Cells(jDebutPL, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalPL
End If
Dim TotalKY As Double
If KY <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Kayser"
j = j + 1
Dim jDebutKY As Integer 'pour calculer le sous total BP on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutKY = j
Do While KY > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Kayser" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
KY = KY - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes KY
Cells(j, 5) = "Total EK"
Cells(j, 6).Font.Bold = True
TotalKY = Application.WorksheetFunction.Sum(Range(Cells(jDebutKY, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalKY
End If
Dim TotalBP As Double
If BP <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Blue Pumpkin"
j = j + 1
Dim jDebutBP As Integer 'pour calculer le sous total BP on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutBP = j
Do While BP > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Blue Pumpkin" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BP = BP - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes BP
Cells(j, 5) = "Total BP"
Cells(j, 6).Font.Bold = True
TotalBP = Application.WorksheetFunction.Sum(Range(Cells(jDebutBP, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBP
End If
Dim TotalTR As Double
If TR <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Terrazza"
j = j + 1
Dim jDebutTR As Integer 'pour calculer le sous total TR on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutTR = j
Do While TR > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Terrazza" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
TR = TR - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes TR
Cells(j, 5) = "Total TR"
Cells(j, 6).Font.Bold = True
TotalTR = Application.WorksheetFunction.Sum(Range(Cells(jDebutTR, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalTR
End If
Dim TotalDM As Double
If DM <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Dan Meat"
j = j + 1
Dim jDebutDM As Integer
jDebutDM = j
Do While DM > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Dan Meat" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
DM = DM - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total DM"
Cells(j, 6).Font.Bold = True
TotalDM = Application.WorksheetFunction.Sum(Range(Cells(jDebutDM, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalDM
End If
Dim TotalMF As Double
If MF <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Mao Fishmonger"
j = j + 1
Dim jDebutMF As Integer
jDebutMF = j
Do While MF > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Mao Fishmonger" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
MF = MF - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total MF"
Cells(j, 6).Font.Bold = True
TotalMF = Application.WorksheetFunction.Sum(Range(Cells(jDebutMF, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalMF
End If
Dim TotalWH As Double
If WH <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Warehouse"
j = j + 1
Dim jDebutWH As Integer 'pour calculer le sous total TR on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutWH = j
Do While WH > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Warehouse" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
WH = WH - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes TR
Cells(j, 5) = "Total WH"
Cells(j, 6).Font.Bold = True
TotalWH = Application.WorksheetFunction.Sum(Range(Cells(jDebutWH, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalWH
End If
Dim TotalLSH As Double
If LSH <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "LSH"
j = j + 1
Dim jDebutLSH As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutLSH = j
Do While LSH > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "LSH" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LSH = LSH - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total LSH"
Cells(j, 6).Font.Bold = True
TotalLSH = Application.WorksheetFunction.Sum(Range(Cells(jDebutLSH, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLSH
End If
Dim TotalSO As Double
Dim wbTemp As Workbook
Set wbTemp = ThisWorkbook
Dim wsTemp As Worksheet
Set wsTemp = wbTemp.Worksheets(1)
If SO <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Stock Office"
j = j + 1
Dim jDebutSO As Integer 'pour calculer le sous total SO on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutSO = j
On Error GoTo errorHandler
Dim wbStock As Workbook
Dim wsStock As Worksheet
Set wbStock = Workbooks.Open("C:\Users\delim\Google Drive\DELIMARKET\ORDERS\Suivi Stock Office.xlsx")
Set wsStock = wbStock.Worksheets(1)
suiviOffice:
Dim plageDeRecherche As Range 'on definit la plage de cellule sur laquelle on fait la recherche du code barre
Set plageDeRecherche = Range(wsStock.Cells(2, 3), wsStock.Cells(400, 3))
wsTemp.Activate
Do While SO > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Stock Office" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
SO = SO - 1
i = i + 1
Dim SKU As String
Dim nbItem As Integer
Dim nomProd As String
SKU = Cells(j, 2)
nbItem = Cells(j, 3)
nomProd = Cells(j, 1)
wsStock.Activate
Dim trouve As Range
Set trouve = plageDeRecherche.Cells.Find(what:=SKU, LookAt:=xlWhole)
trouve.Offset(0, 2).Value = trouve.Offset(0, 2).Value - nbItem
If trouve.Offset(0, 2).Value < 3 And trouve.Offset(0, 2).Value >= 0 Then
MsgBox "Attention ! Il ne reste que " & trouve.Offset(0, 2).Value & " item(s) de '" & nomProd & "' en stock."
End If
If trouve.Offset(0, 2).Value < 0 Then
MsgBox "Attention ! Il manque " & -trouve.Offset(0, 2).Value & " item(s) de '" & nomProd & "'."
trouve.Offset(0, 2) = 0
End If
j = j + 1
wsTemp.Activate
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes SO
Cells(j, 5) = "Total SO"
Cells(j, 6).Font.Bold = True
TotalSO = Application.WorksheetFunction.Sum(Range(Cells(jDebutSO, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalSO
wbStock.Save
wbStock.Close False
End If
Dim TotalMU As Double
If MU <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Mu"
j = j + 1
Dim jDebutMU As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutMU = j
Do While MU > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Mu" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
MU = MU - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total Mu"
Cells(j, 6).Font.Bold = True
TotalMU = Application.WorksheetFunction.Sum(Range(Cells(jDebutMU, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalMU
End If
Dim TotalLVC As Double
If LVC <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "La Vie Claire"
j = j + 1
Dim jDebutLVC As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutLVC = j
Do While LVC > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "La Vie Claire" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LVC = LVC - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total LVC"
Cells(j, 6).Font.Bold = True
TotalLVC = Application.WorksheetFunction.Sum(Range(Cells(jDebutLVC, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLVC
End If
Dim TotalAUS As Double
If AUS <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Auskhmer"
j = j + 1
Dim jDebutAUS As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutAUS = j
Do While AUS > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Auskhmer" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
AUS = AUS - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total AUS"
Cells(j, 6).Font.Bold = True
TotalAUS = Application.WorksheetFunction.Sum(Range(Cells(jDebutAUS, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalAUS
End If
Dim TotalAY As Double
If AY <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Addy Yogurt"
j = j + 1
Dim jDebutAY As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutAY = j
Do While AY > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Addy Yogurt" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
AY = AY - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total AY"
Cells(j, 6).Font.Bold = True
TotalAY = Application.WorksheetFunction.Sum(Range(Cells(jDebutAY, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalAY
End If
Dim TotalGH As Double
If GH <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Goodhill"
j = j + 1
Dim jDebutGH As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutGH = j
Do While GH > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Goodhill" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
GH = GH - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total GH"
Cells(j, 6).Font.Bold = True
TotalGH = Application.WorksheetFunction.Sum(Range(Cells(jDebutGH, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalGH
End If
Dim TotalBOD As Double
If BOD <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Bodia"
j = j + 1
Dim jDebutBOD As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutBOD = j
Do While BOD > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Bodia" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BOD = BOD - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total BOD"
Cells(j, 6).Font.Bold = True
TotalBOD = Application.WorksheetFunction.Sum(Range(Cells(jDebutBOD, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBOD
End If
Dim TotalFCF As Double
If FCF <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Francam Foods"
j = j + 1
Dim jDebutFCF As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutFCF = j
Do While FCF > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Francam Foods" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
FCF = FCF - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total FCF"
Cells(j, 6).Font.Bold = True
TotalFCF = Application.WorksheetFunction.Sum(Range(Cells(jDebutFCF, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalFCF
End If
Dim TotalUC As Double
If UC <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "U Care"
j = j + 1
Dim jDebutUC As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutUC = j
Do While UC > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "U Care" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
UC = UC - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total UC"
Cells(j, 6).Font.Bold = True
TotalUC = Application.WorksheetFunction.Sum(Range(Cells(jDebutUC, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalUC
End If
Dim TotalYR As Double
If YR <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Yves Rocher"
j = j + 1
Dim jD_butYR As Integer 'pour calculer le sous total LT on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutYR = j
Do While YR > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Yves Rocher" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
YR = YR - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes LT
Cells(j, 5) = "Total YR"
Cells(j, 6).Font.Bold = True
TotalYR = Application.WorksheetFunction.Sum(Range(Cells(jDebutYR, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalYR
End If
Dim TotalLKD As Double
If LKD <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Lucky Drink"
j = j + 1
Dim jDebutLKD As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutLKD = j
Do While LKD > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Lucky Drink" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LKD = LKD - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total LKD"
Cells(j, 6).Font.Bold = True
TotalLKD = Application.WorksheetFunction.Sum(Range(Cells(jDebutLKD, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLKD
End If
Dim TotalRC As Double
If RC <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Royal Canin"
j = j + 1
Dim jDebutRC As Integer
jDebutRC = j
Do While RC > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Royal Canin" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
RC = RC - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total RC"
Cells(j, 6).Font.Bold = True
TotalRC = Application.WorksheetFunction.Sum(Range(Cells(jDebutRC, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalRC
End If
Dim TotalTH As Double
If TH <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Thai Huot"
j = j + 1
Dim jDebutTH As Integer
jDebutTH = j
Do While TH > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Thai Huot" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
TH = TH - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total TH"
Cells(j, 6).Font.Bold = True
TotalTH = Application.WorksheetFunction.Sum(Range(Cells(jDebutTH, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalTH
End If
Dim TotalCM As Double
If CM <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Chip Mong"
j = j + 1
Dim jDebutCM As Integer
jDebutCM = j
Do While CM > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Chip Mong" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
CM = CM - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total CM"
Cells(j, 6).Font.Bold = True
TotalCM = Application.WorksheetFunction.Sum(Range(Cells(jDebutCM, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalCM
End If
Dim TotalBY As Double
If BY <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Bayon"
j = j + 1
Dim jDebutBY As Integer
jDebutBY = j
Do While BY > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Bayon" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BY = BY - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total BY"
Cells(j, 6).Font.Bold = True
TotalBY = Application.WorksheetFunction.Sum(Range(Cells(jDebutBY, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBY
End If
Dim TotalLM As Double
If LM <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Le Marche"
j = j + 1
Dim jDebutLM As Integer
jDebutLM = j
Do While LM > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Le Marche" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LM = LM - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total LM"
Cells(j, 6).Font.Bold = True
TotalLM = Application.WorksheetFunction.Sum(Range(Cells(jDebutLM, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLM
End If
Dim TotalRM As Double
If RM <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Royal Mart"
j = j + 1
Dim jDebutRM As Integer
jDebutRM = j
Do While RM > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Royal Mart" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
RM = RM - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total RM"
Cells(j, 6).Font.Bold = True
TotalRM = Application.WorksheetFunction.Sum(Range(Cells(jDebutRM, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalRM
End If
Dim TotalLKM As Double
If LKM <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Lucky Market"
j = j + 1
Dim jDebutLKM As Integer
jDebutLKM = j
Do While LKM > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Lucky Market" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LKM = LKM - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total LKM"
Cells(j, 6).Font.Bold = True
TotalLKM = Application.WorksheetFunction.Sum(Range(Cells(jDebutLKM, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLKM
End If
Dim TotalANI As Double
If ANI <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Animal Mama"
j = j + 1
Dim jDebutANI As Integer
jDebutANI = j
Do While ANI > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Animal Mama" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
ANI = ANI - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total ANI"
Cells(j, 6).Font.Bold = True
TotalANI = Application.WorksheetFunction.Sum(Range(Cells(jDebutANI, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalANI
End If
Dim TotalDS As Double
If DS <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "DS"
j = j + 1
Dim jDebutDS As Integer
jDebutDS = j
Do While DS > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "DS" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
DS = DS - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total DS"
Cells(j, 6).Font.Bold = True
TotalDS = Application.WorksheetFunction.Sum(Range(Cells(jDebutDS, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalDS
End If
Dim TotalDAI As Double
If DAI <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "DailyMarche"
j = j + 1
Dim jDebutDAI As Integer
jDebutDAI = j
Do While DAI > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "DailyMarche" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
DAI = DAI - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total DAI"
Cells(j, 6).Font.Bold = True
TotalDAI = Application.WorksheetFunction.Sum(Range(Cells(jDebutDAI, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalDAI
End If
Dim TotalHGD As Double
If HGD <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Haagen Dazs"
j = j + 1
Dim jDebutHGD As Integer
jDebutHGD = j
Do While HGD > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Haagen Dazs" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
HGD = HGD - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total HGD"
Cells(j, 6).Font.Bold = True
TotalHGD = Application.WorksheetFunction.Sum(Range(Cells(jDebutHGD, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalHGD
End If
Dim TotalVMT As Double
If VMT <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Vimean Tip"
j = j + 1
Dim jDebutVMT As Integer
jDebutVMT = j
Do While VMT > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Vimean Tip" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
VMT = VMT - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total VMT"
Cells(j, 6).Font.Bold = True
TotalVMT = Application.WorksheetFunction.Sum(Range(Cells(jDebutVMT, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalVMT
End If
Dim TotalMH As Double
If MH <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "MH"
j = j + 1
Dim jDebutMH As Integer
jDebutMH = j
Do While MH > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "MH" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
MH = MH - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total MH"
Cells(j, 6).Font.Bold = True
TotalMH = Application.WorksheetFunction.Sum(Range(Cells(jDebutMH, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalMH
End If
Dim TotalAM As Double
If AM <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Angkor Market"
j = j + 1
Dim jDebutAM As Integer
jDebutAM = j
Do While AM > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Angkor Market" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
AM = AM - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total AM"
Cells(j, 6).Font.Bold = True
TotalAM = Application.WorksheetFunction.Sum(Range(Cells(jDebutAM, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalAM
End If
Dim TotalCF As Double
If CF <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Confirel"
j = j + 1
Dim jDebutCF As Integer 'pour calculer le sous total AN on a besoin de savoir _ partir de quelle ligne commence les produits de ce fournisseur
jDebutCF = j
Do While CF > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Confirel" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
CF = CF - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True 'calcul le sous total des commandes AN
Cells(j, 5) = "Total CF"
Cells(j, 6).Font.Bold = True
TotalCF = Application.WorksheetFunction.Sum(Range(Cells(jDebutCF, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalCF
End If
Dim TotalNV As Double
If NV <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Navetco"
j = j + 1
Dim jDebutNV As Integer
jDebutNV = j
Do While NV > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Navetco" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
NV = NV - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total NV"
Cells(j, 6).Font.Bold = True
TotalNV = Application.WorksheetFunction.Sum(Range(Cells(jDebutNV, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalNV
End If
Dim TotalCA As Double
If CA <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Celliers d'Asie"
j = j + 1
Dim jDebutCA As Integer
jDebutCA = j
Do While CA > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Celliers d'Asie" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
CA = CA - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total CA"
Cells(j, 6).Font.Bold = True
TotalCA = Application.WorksheetFunction.Sum(Range(Cells(jDebutCA, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalCA
End If
Dim TotalOS As Double
If OS <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Ostra"
j = j + 1
Dim jDebutOS As Integer
jDebutOS = j
Do While OS > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Ostra" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
OS = OS - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total OS"
Cells(j, 6).Font.Bold = True
TotalOS = Application.WorksheetFunction.Sum(Range(Cells(jDebutOS, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalOS
End If
Dim TotalBON As Double
If BON <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Bonbon"
j = j + 1
Dim jDebutBON As Integer
jDebutBON = j
Do While BON > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Bonbon" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BON = BON - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total BON"
Cells(j, 6).Font.Bold = True
TotalBON = Application.WorksheetFunction.Sum(Range(Cells(jDebutBON, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBON
End If
Dim TotalBS As Double
If BS <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Baby Shop"
j = j + 1
Dim jDebutBS As Integer
jDebutBS = j
Do While BS > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Baby Shop" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BS = BS - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total BS"
Cells(j, 6).Font.Bold = True
TotalBS = Application.WorksheetFunction.Sum(Range(Cells(jDebutBS, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBS
End If
Dim TotalLG As Double
If LG <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Legrand"
j = j + 1
Dim jDebutLG As Integer
jDebutLG = j
Do While LG > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Legrand" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LG = LG - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total LG"
Cells(j, 6).Font.Bold = True
TotalLG = Application.WorksheetFunction.Sum(Range(Cells(jDebutLG, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLG
End If
Dim TotalAR As Double
If AR <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Arthemis"
j = j + 1
Dim jDebutAR As Integer
jDebutAR = j
Do While AR > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Arthemis" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
AR = AR - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total AR"
Cells(j, 6).Font.Bold = True
TotalAR = Application.WorksheetFunction.Sum(Range(Cells(jDebutAR, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalAR
End If
Dim TotalBIO As Double
If BIO <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Baby Bio"
j = j + 1
Dim jDebutBIO As Integer
jDebutBIO = j
Do While BIO > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Baby Bio" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BIO = BIO - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total BIO"
Cells(j, 6).Font.Bold = True
TotalBIO = Application.WorksheetFunction.Sum(Range(Cells(jDebutBIO, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBIO
End If
Dim TotalMDE As Double
If MDE <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Maison d'Europe"
j = j + 1
Dim jDebutMDE As Integer
jDebutMDE = j
Do While MDE > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Maison d'Europe" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
MDE = MDE - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total MDE"
Cells(j, 6).Font.Bold = True
TotalMDE = Application.WorksheetFunction.Sum(Range(Cells(jDebutMDE, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalMDE
End If
Dim TotalAN As Double
If AN <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Annam"
j = j + 1
Dim jDebutAN As Integer
jDebutAN = j
Do While AN > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Annam" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
AN = AN - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total AN"
Cells(j, 6).Font.Bold = True
TotalAN = Application.WorksheetFunction.Sum(Range(Cells(jDebutAN, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalAN
End If
Dim TotalSV As Double
If SV <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Sonavith"
j = j + 1
Dim jDebutSV As Integer
jDebutSV = j
Do While SV > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Sonavith" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
SV = SV - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total SV"
Cells(j, 6).Font.Bold = True
TotalSV = Application.WorksheetFunction.Sum(Range(Cells(jDebutSV, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalSV
End If
Dim TotalIND As Double
If IND <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Indoguna"
j = j + 1
Dim jDebutIND As Integer
jDebutIND = j
Do While IND > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Indoguna" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
IND = IND - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total IND"
Cells(j, 6).Font.Bold = True
TotalIND = Application.WorksheetFunction.Sum(Range(Cells(jDebutIND, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalIND
End If
Dim TotalCFS As Double
If CFS <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Cambodia Food Service"
j = j + 1
Dim jDebutCFS As Integer
jDebutCFS = j
Do While CFS > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Cambodia Food Service" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
CFS = CFS - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total CFS"
Cells(j, 6).Font.Bold = True
TotalCFS = Application.WorksheetFunction.Sum(Range(Cells(jDebutCFS, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalCFS
End If
Dim TotalBLD As Double
If BLD <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Blends"
j = j + 1
Dim jDebutBLD As Integer
jDebutBLD = j
Do While BLD > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Blends" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
BLD = BLD - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total BLD"
Cells(j, 6).Font.Bold = True
TotalBLD = Application.WorksheetFunction.Sum(Range(Cells(jDebutBLD, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalBLD
End If
Dim TotalLP As Double
If LP <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "La Plantation"
j = j + 1
Dim jDebutLP As Integer
jDebutLP = j
Do While LP > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "La Plantation" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
LP = LP - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total LP"
Cells(j, 6).Font.Bold = True
TotalLP = Application.WorksheetFunction.Sum(Range(Cells(jDebutLP, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalLP
End If
Dim TotalIG As Double
If IG <> 0 Then
j = j + 1
i = 2
Cells(j, 1).Font.Bold = True
Cells(j, 1) = "Italian Gourmet"
j = j + 1
Dim jDebutIG As Integer
jDebutIG = j
Do While IG > 0 And Cells(i, 13).Value <> ""
If Cells(i, 13).Value = "Italian Gourmet" Then
Range(Cells(i, 8), Cells(i, 12)).Copy
Cells(j, 1).Select
ActiveSheet.Paste
Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
j = j + 1
IG = IG - 1
i = i + 1
Else
i = i + 1
End If
Loop
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total IG"
Cells(j, 6).Font.Bold = True
TotalIG = Application.WorksheetFunction.Sum(Range(Cells(jDebutIG, 6), Cells(j - 1, 6)))
Cells(j, 6) = TotalIG
End If
'Dim TotalX As Double
'
'If X <> 0 Then
' j = j + 1
' i = 2
' Cells(j, 1).Font.Bold = True
' Cells(j, 1) = "Nom du fournisseur X"
' j = j + 1
'
' Dim jDebutX As Integer
' jDebutX = j
'
' Do While X > 0 And Cells(i, 13).Value <> ""
' If Cells(i, 13).Value = "Nom du fournisseur X" Then
' Range(Cells(i, 8), Cells(i, 12)).Copy
' Cells(j, 1).Select
' ActiveSheet.Paste
' Cells(j, 6) = Cells(j, 3) * Cells(j, 5)
' j = j + 1
' X = X - 1
' i = i + 1
' Else
' i = i + 1
' End If
' Loop
' Cells(j, 5).Font.Bold = True
' Cells(j, 5) = "Total X"
' Cells(j, 6).Font.Bold = True
' TotalX = Application.WorksheetFunction.Sum(Range(Cells(jDebutX, 6), Cells(j - 1, 6)))
' Cells(j, 6) = TotalX
'
'End If
With Range(Cells(6, 1), Cells(j, 6))
.Borders(xlInsideVertical).Weight = xlThin
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
End With
Dim TotalGeneral As Double 'Calcul Total g_n_ral
j = j + 1
Cells(j, 5).Font.Bold = True
Cells(j, 5) = "Total"
Cells(j, 6).Font.Bold = True
TotalGeneral = Application.WorksheetFunction.Sum(Range(Cells(7, 6), Cells(j - 1, 6))) - TotalNG - TotalLT - TotalTR - TotalAN - TotalBP - TotalLV - TotalBF - TotalLSH - TotalLKD - TotalAUS - TotalKY - TotalUC - TotalYR - TotalWH - TotalFCF - TotalBOD - TotalRC - TotalAY - TotalLVC - TotalGH - TotalTH - TotalBY - TotalLM - TotalRM - TotalLKM - TotalANI - TotalMK - TotalAM - TotalNV - TotalPL - TotalMU - TotalCF - TotalVMT - TotalMH - TotalOS - TotalBON - TotalDS - TotalHGD - TotalSO - TotalKB - TotalCM - TotalLG - TotalMF - TotalDM - TotalDAI - TotalAR - TotalBIO - TotalMDE - TotalSV - TotalBON - TotalIND - TotalCFS - TotalBLD - TotalLP - TotalIG
Cells(j, 6) = TotalGeneral
Dim TotalItem As Integer 'Calcul Total item
Cells(j, 2).Font.Bold = True
Cells(j, 2) = "Total item"
Cells(j, 3).Font.Bold = True
TotalItem = Application.WorksheetFunction.Sum(Range(Cells(7, 3), Cells(j - 1, 3)))
Cells(j, 3) = TotalItem
Range("A6").Select
errorHandler:
If Err.Number = 1004 Then
Dim b As Boolean
b = ExisteFichier("C:\Users\Julien Nguyen\Google*Drive Delishop\DELISHOP\ORDERS\Suivi Stock Office.xlsx")
If b = True Then
Set wbStock = Workbooks.Open("C:\Users\Julien Nguyen\Google*Drive Delishop\DELISHOP\ORDERS\Suivi Stock Office.xlsx")
Set wsStock = wbStock.Worksheets(1)
Resume suiviOffice
Else
b = ExisteFichier("D:\Google*Drive Delishop\DELISHOP\ORDERS\Suivi Stock Office.xlsx")
If b = True Then
Set wbStock = Workbooks.Open("D:\Google*Drive Delishop\DELISHOP\ORDERS\Suivi Stock Office.xlsx")
Set wsStock = wbStock.Worksheets(1)
Resume suiviOffice
Else
b = ExisteFichier("C:\Users\Delis\Google Drive\DELISHOP\ORDERS\Suivi Stock Office.xlsx")
If b = True Then
Set wbStock = Workbooks.Open("C:\Users\Delis\Google Drive\DELISHOP\ORDERS\Suivi Stock Office.xlsx")
Set wsStock = wbStock.Worksheets(1)
Resume suiviOffice
Else
b = ExisteFichier("C:\Users\Lenovo\Google Drive\DELIMARKET\ORDERS\Suivi Stock Office.xlsx")
If b = True Then
Set wbStock = Workbooks.Open("C:\Users\Lenovo\Google Drive\DELIMARKET\ORDERS\Suivi Stock Office.xlsx")
Set wsStock = wbStock.Worksheets(1)
Resume suiviOffice
End If
End If
End If
End If
End If
End Sub |
Partager