récupérer des dates grâce à un combo

  • Initiateur de la discussion Initiateur de la discussion arvin
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

arvin

XLDnaute Occasionnel
bonjour à tous,

j'ai un souci

feuil 2 'toto'-> j'ai des dates du 01/01/05 -> 31/12/05
feuil1 -> je récupère ces dates grâce à un combo : mais il récupère mal les dates

qu'ai je oublié ??

merci et bonne journée


Private Sub UserForm_Initialize()
Dim c As Range
Dim datanoms As New Collection
Dim item

'1er combo date
On Error Resume Next
For Each c In Range('toto!A1:A' & Range('toto!A65000').End(xlUp).Row)
datanoms.Add c.Text, c.Text
Next c
For Each item In datanoms
ComboBox3.AddItem item
Next item
ComboBox3.List = ListSort(ComboBox3.List)
 
Bonjour

on doit faire plus simple peut-être comme ceci

Private Sub UserForm_Initialize()
Dim c As Integer

For c = 1 to sheets('toto).range('A65536').End(xlUp).Row)
datanoms.Additem sheets('toto).range('A' & c)
Next c

End sub

Message édité par: Pascal76, à: 08/11/2005 13:28
 
bonjour Hervé

et voici:

Function ListSort(liSte)
Dim First As Integer, Last As Integer
Dim i As Integer, j As Integer
Dim Temp

First = LBound(liSte)
Last = UBound(liSte)
For i = First To Last - 1
For j = i + 1 To Last
If liSte(i, 0) > liSte(j, 0) Then
Temp = liSte(j, 0)
liSte(j, 0) = liSte(i, 0)
liSte(i, 0) = Temp
End If
Next j
Next i
ListSort = liSte
End Function
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
0
Affichages
663
Réponses
3
Affichages
919
Retour