Hi,
with the following data, i am autofiltering the Article column using the scripting dictionary, and cycling through each article, i am clueless how to apply the following based on the condition.
Case 1
When Backsheet (3.5mm) in column D with respect to the Article (column C) (001.WU_1D1S_450) means Height Ghadi (column K)has to be filled as HG in the corresponding rows of the Panel - Top, Panel - Right,Panel - Left, Panel - Bottom for the article (001.WU_1D1S_450)
similary, wherever the Backsheet (3.5mm), for the respective Article, the rows of the Panel - Top, Panel - Right,Panel - Left, Panel - Bottom has to be filled as HG in the Height Ghadi (column K)
Case 2,
when the column D has Backsheet (3.5mm)_MF, the above procedure is done plus, the Factory check (column L) has to fill the "Minifix-01" for the corresponding rows of the Panel - Top, Panel - Right,Panel - Left, Panel - Bottom of the article. This minixfix-01 has to be incremented as "Minifix-01", "Minifix-02","Minifix-03".
with the following data, i am autofiltering the Article column using the scripting dictionary, and cycling through each article, i am clueless how to apply the following based on the condition.
Case 1
When Backsheet (3.5mm) in column D with respect to the Article (column C) (001.WU_1D1S_450) means Height Ghadi (column K)has to be filled as HG in the corresponding rows of the Panel - Top, Panel - Right,Panel - Left, Panel - Bottom for the article (001.WU_1D1S_450)
similary, wherever the Backsheet (3.5mm), for the respective Article, the rows of the Panel - Top, Panel - Right,Panel - Left, Panel - Bottom has to be filled as HG in the Height Ghadi (column K)
Case 2,
when the column D has Backsheet (3.5mm)_MF, the above procedure is done plus, the Factory check (column L) has to fill the "Minifix-01" for the corresponding rows of the Panel - Top, Panel - Right,Panel - Left, Panel - Bottom of the article. This minixfix-01 has to be incremented as "Minifix-01", "Minifix-02","Minifix-03".
VBA Code:
Sub filter()
Dim shtSrc As Worksheet, shtDest As Worksheet
Dim rngSrc As Range, arrSrc As Variant
Dim lrowSrc As Long, lcolSrc As Long, colSrcFltr As Long
Dim dictMaterial As Object, dictKey As String, vKey As Variant
Dim i As Long
Dim sName As String
Dim illegalNmChar As Variant
Dim replaceNmChr As String
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
illegalNmChar = Array("/", "\", "[", "]", "*", "?", ":")
replaceNmChr = "|"
Set shtSrc = Worksheets("01_CutlistExport_DMH") ' <--- Change to your sheet name
With shtSrc
lrowSrc = .Cells(Rows.Count, "B").End(xlUp).Row
lcolSrc = .Cells(6, Columns.Count).End(xlToLeft).Column
Set rngSrc = .Range(.Cells(1, "A"), .Cells(lrowSrc, lcolSrc))
arrSrc = rngSrc
colSrcFltr = .Columns("C").Column - rngSrc.Cells(1).Column + 1 ' <--- Column letter to use for filtering
End With
Set dictMaterial = CreateObject("Scripting.dictionary")
' Load unique materials into Dictionary
For i = 2 To UBound(arrSrc)
dictKey = arrSrc(i, colSrcFltr)
If Not dictMaterial.Exists(dictKey) And dictKey <> "" Then
dictMaterial(dictKey) = i
End If
Next i
If shtSrc.AutoFilterMode Then shtSrc.AutoFilterMode = False
For Each vKey In dictMaterial.keys
rngSrc.AutoFilter Field:=colSrcFltr, Criteria1:=vKey
Next vKey
End Sub
TESTT_01_CutlistExport_DMH_231226_12-07-21A.xlsx | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | |||
1 | Sl.No | ORDERNAME | Article | NAME | Height | Width | Thickness | Qty | HEIGHT GHADI | Factory Check | Site Check | MATID | MATCAT | MATGRID | CLENG | CWIDTH | FTHK | DELIVERY DATE | BARCODE1 | BARCODE2 | ID | TYP | CUSTOMER | ||||
2 | 1 | TESTT | 001.WU_1D1S_450 | Adjusting Shelf | 414 | 250 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 412 | 248 | 18 | 16389 | 3 | , | ||||||||||
3 | 2 | TESTT | 001.WU_1D1S_450 | Panel - Bottom | 414 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 412 | 293 | 18 | 16387 | 5 | , | ||||||||||
4 | 3 | TESTT | 001.WU_1D1S_450 | Panel - Left | 600 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 598 | 293 | 18 | 16386 | 1 | , | ||||||||||
5 | 4 | TESTT | 001.WU_1D1S_450 | Panel - Right | 600 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 598 | 293 | 18 | 16385 | 1 | , | ||||||||||
6 | 5 | TESTT | 001.WU_1D1S_450 | Panel - Top | 414 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 412 | 293 | 18 | 16388 | 4 | , | ||||||||||
7 | 6 | TESTT | 001.WU_1D1S_450 | Backsheet (3.5mm) | 580 | 430 | 3.5 | 1 | DMHT_BWP_RW_3n5 | HG_Decor_Panel | 0 | 580 | 430 | 5.5 | 16391 | 6 | , | ||||||||||
8 | 7 | TESTT | 001.WU_1D1S_450 | Door panel | 598 | 448 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 594 | 444 | 18 | 16390 | 8 | , | ||||||||||
9 | 8 | TESTT | 002.WU_2D1S_600 | Adjusting Shelf | 564 | 250 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 562 | 248 | 18 | 16396 | 3 | , | ||||||||||
10 | 9 | TESTT | 002.WU_2D1S_600 | Panel - Bottom | 564 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 562 | 293 | 18 | 16394 | 5 | , | ||||||||||
11 | 10 | TESTT | 002.WU_2D1S_600 | Panel - Left | 600 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 598 | 293 | 18 | 16393 | 1 | , | ||||||||||
12 | 11 | TESTT | 002.WU_2D1S_600 | Panel - Right | 600 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 598 | 293 | 18 | 16392 | 1 | , | ||||||||||
13 | 12 | TESTT | 002.WU_2D1S_600 | Panel - Top | 564 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 562 | 293 | 18 | 16395 | 4 | , | ||||||||||
14 | 13 | TESTT | 002.WU_2D1S_600 | Backsheet (3.5mm) | 580 | 580 | 3.5 | 1 | DMHT_BWP_RW_3n5 | HG_Decor_Panel | 0 | 580 | 580 | 5.5 | 16399 | 6 | , | ||||||||||
15 | 14 | TESTT | 002.WU_2D1S_600 | Shutter | 598 | 298 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 594 | 294 | 18 | 16397 | 9 | , | ||||||||||
16 | 15 | TESTT | 002.WU_2D1S_600 | Shutter | 598 | 298 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 594 | 294 | 18 | 16398 | 10 | , | ||||||||||
17 | 16 | TESTT | 003.WU_O1S_300 | Fixed Shelf | 264 | 297 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 262 | 295 | 18 | 16404 | 13 | , | ||||||||||
18 | 17 | TESTT | 003.WU_O1S_300 | Panel - Top | 264 | 315 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 262 | 313 | 18 | 16403 | 4 | , | ||||||||||
19 | 18 | TESTT | 003.WU_O1S_300 | Backsheet (3.5mm)_MF | 580 | 280 | 3.5 | 1 | DMHT_BWP_RW_3n5 | HG_Decor_Panel | 0 | 580 | 280 | 5.5 | 16405 | 6 | , | ||||||||||
20 | 19 | TESTT | 003.WU_O1S_300 | Panel - Bottom | 300 | 315 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 296 | 311 | 18 | 16402 | 5 | , | ||||||||||
21 | 20 | TESTT | 003.WU_O1S_300 | Side Panel | 582 | 315 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 578 | 311 | 18 | 16400 | 1 | , | ||||||||||
22 | 21 | TESTT | 003.WU_O1S_300 | Side Panel | 582 | 315 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 578 | 311 | 18 | 16401 | 1 | , | ||||||||||
23 | 22 | TESTT | 004.WU_2D1S_800 | Adjusting Shelf | 764 | 250 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 762 | 248 | 18 | 16410 | 3 | , | ||||||||||
24 | 23 | TESTT | 004.WU_2D1S_800 | Panel - Bottom | 764 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 762 | 293 | 18 | 16408 | 5 | , | ||||||||||
25 | 24 | TESTT | 004.WU_2D1S_800 | Panel - Left | 600 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 598 | 293 | 18 | 16407 | 1 | , | ||||||||||
26 | 25 | TESTT | 004.WU_2D1S_800 | Panel - Right | 600 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 598 | 293 | 18 | 16406 | 1 | , | ||||||||||
27 | 26 | TESTT | 004.WU_2D1S_800 | Panel - Top | 764 | 295 | 16 | 1 | DMHT_BWP_RW_16mm | HG_Decor_Panel | 0 | 762 | 293 | 18 | 16409 | 4 | , | ||||||||||
28 | 27 | TESTT | 004.WU_2D1S_800 | Backsheet | 580 | 780 | 3.5 | 1 | DMHT_BWP_RW_3n5 | HG_Decor_Panel | 0 | 580 | 780 | 5.5 | 16413 | 6 | , | ||||||||||
29 | 28 | TESTT | 004.WU_2D1S_800 | Shutter | 598 | 398 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 594 | 394 | 18 | 16411 | 9 | , | ||||||||||
30 | 29 | TESTT | 004.WU_2D1S_800 | Shutter | 598 | 398 | 16 | 1 | DMHT_HDHMR_RW_16mm | MDF | 0 | 594 | 394 | 18 | 16412 | 10 | , | ||||||||||
01_CutlistExport_DMH |