boucle sur colonne

boucle sur colonne - VB/VBA/VBS - Programmation

Marsh Posté le 08-04-2009 à 12:44:47    

Bonjour,  
Je voudrais faire une boucle sur mes colonnes a partir de la cellule G3 sans doublons mais je n' y arrive pas.
Voici mon code :
 
---------------------------------------------------------------
Dim oRange As Range
For Each oRange In Feuil2.Range("G3:DD3" )
 
If UserForm8.ComboBox1.ListIndex = -1 Then
UserForm8.ComboBox1.AddItem oRange.Value
End If
 
Next oRange
-----------------------------------------------------------------------
 
Pouvez vous me dire ce qui cloche ?

Reply

Marsh Posté le 08-04-2009 à 12:44:47   

Reply

Marsh Posté le 08-04-2009 à 14:14:50    

Dim oRange As Range
Dim Nouveau as Boolean
For Each oRange In Feuil2.Range("D3:DD3" )
    nouveau = True
    For i = 1 To UserForm8.ComboBox1.ListCount
        If oRange.Value = UserForm8.ComboBox1.List(i - 1) Then nouveau = False
    Next
    If nouveau Then
        UserForm8.ComboBox1.AddItem oRange.Value
    End If
Next oRange

Reply

Marsh Posté le 14-04-2009 à 18:09:13    

Je te remercie !
J'ai un autre code qui peut intéresser des gens :
 
Dim oRange As Range
For Each oRange In Feuil2.Range("G3:DD3" )
 
If oRange.Value = "" And oRange.Value = "Quantité" And oRange.Value = "conforme" And UserForm8.ComboBox1.ListIndex = -1 Then
Else
UserForm8.ComboBox1.AddItem oRange.Value
End If
 
Next oRange
 
For i = 0 To UserForm8.ComboBox1.ListCount - 1
For j = UserForm8.ComboBox1.ListCount - 1 To i + 1 Step -1
If UserForm8.ComboBox1.List(i) = UserForm8.ComboBox1.List(j) Then UserForm8.ComboBox1.RemoveItem (j)
Next j
Next i

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed