Regueiro
XLDnaute Impliqué
Bonsoir le Forum
J'aimerais copier dans un range discontinue les valeurs de mondico
La plage de destination PlageChoix comporte 15 cellules comme les 15 de mondico.
voici le code :
J'aimerais copier dans un range discontinue les valeurs de mondico
La plage de destination PlageChoix comporte 15 cellules comme les 15 de mondico.
voici le code :
Code:
Option Explicit
Option Compare Text
Sub Proc111()
Dim Maliste2 As ListObject
Dim FDO As Worksheet
Dim FSOUD As Worksheet
Dim Result
Dim PlageChoix()
Dim C As Range
Dim Plage As Variant
Dim Cel As Range
Dim temp
Dim MonDico As Scripting.Dictionary
Dim a As Long
Dim i%
Set FDO = Sheets("DONNEES")
Set FSOUD = Worksheets("SOUDURE_ANGLE")
Set Maliste2 = FDO.ListObjects("Tableau3")
PlageChoix = Array(FDO.Range("D42:D44"), FDO.Range("D46:D48"), FDO.Range("I46:I48"), FDO.Range("D50:D52"), FDO.Range("I50:I52"))
'Set choix = FSOUD.Range("D42:D44,D46:D48,I46:I48,D50:D52,I50:I52")
Set MonDico = New Dictionary
Result = FSOUD.OLEObjects("ComboBox1").Object.Value
MsgBox Left(Result, 3)
For Each C In Maliste2.DataBodyRange.Columns(1).Cells
If C.Text = Left(Result, 3) Then MonDico(C.Offset(, 1).Value) = "" ' si famille alors on ajoute l'élément de la sous-famille au dictionnaire
For i = 0 To 4
MsgBox PlageChoix(i).Address
For Each Plage In PlageChoix(i)
For Each Cel In Plage.Cells
For a = 1 To MonDico.Count
Cel.Item(a) = MonDico.Keys(a - 1)
Next a
Next Cel
Next Plage
Next i