compréhension technique de la macro
Suite à une demande d'aide concernant un transfert de lignes dans des feuilles ciblées Mercatov (merci à vous ) a écrit cette macro qui marche trés bien . Toutefois débutant je ne comprends pas tous le code ,qu'est ce que typdel
et à quoi correspond ind 0 et ind 3 car je voudrai rajouter un transporteur et j'y arrive pas (la macro commentée serait été ideale)
merci pour vos eclaircissements (à noter que je suis débutant..)
Code:
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
| Dim c As Range, plage As Range
Dim LastLig As Long, i As Long
Dim sht As Worksheet, shtb As Worksheet, shtd As Worksheet
Dim typtra As String, typdel As String, namsht As String
Dim ind As Byte
Set sht = Worksheets("globale")
Set shtb = Sheets("carte des délais")
LastLig = sht.Range("D65536").End(xlUp).Row
For i = 6 To LastLig
typtra = Left(sht.Range("L" & i), 3)
Select Case UCase(typtra)
Case "DHL"
Set plage = shtb.Range("A2:C100") '3colonnes pour DHL
ind = 0
Case "JOY"
Set plage = shtb.Range("D2:F100") '3colonnes pour JOY
ind = 3
Case Else: Exit Sub
End Select
Set c = plage.Find(sht.Range("H" & i).Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
typdel = CStr((c.Column - ind) * 24)
namsht = "" & LCase(typtra & typdel) & ""
Set shtd = Sheets(namsht)
shtd.Rows(shtd.Range("D65536").End(xlUp).Row + 1).Value = sht.Rows(i).Value
End If
Next i
Set sht = Nothing
Set shtb = Nothing
Set shtd = Nothing |