Excel VBA - Comment alimenter une ListBox à partir d'un critère

Cette vidéo vous vous expliquer comment charger des données d'une Base de données dans un contrôle de type ListBox à partir d'un critère de filtre. Code VBA : Private Sub btnRegion_Click() 'Décalaration des variables Dim Critere Dim DerniereLigne As Integer, x As Integer 'Affectation des variables Critere = Range("M4") 'On récupère la dernière ligne de la source de données If Cells(Rows.Count, 1).End(xlUp).Row = 1 Then DerniereLigne = 2 Else DerniereLigne = Cells(Rows.Count, 1).End(xlUp).Row End If 'On efface le contenu de la liste à chaque recherche. lstRegion.Clear lstRegion.BackColor = RGB(100, 100, 400) 'On parcours la source de données de la ligne à la dernière ligne For x = 1 To DerniereLigne 'On teste le critère, ici le contenu de M4 avec la source de données. If Cells(x, 5) = Critere Then 'On ecrit dans la listbox Me.lstRegion.AddItem Cells(x, 1) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 1) = Cells(x, 2) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 2) = Cells(x, 3) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 3) = Cells(x, 4) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 4) = Cells(x, 5) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 5) = Cells(x, 6) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 6) = Cells(x, 7) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 7) = Cells(x, 8) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 8) = Cells(x, 9) Me.lstRegion.List(Me.lstRegion.ListCount - 1, 9) = Cells(x, 10) End If Next x End Sub --------------------------------------------------------------------------------------------------------- Cliquez sur le lien ci-dessous pour télécharger le fichier source : https://learnaccess.kneo.me/content/b... --------------------------------------------------------------------------------------------------------- ================================================ Consulter ma Boutique en ligne : https://learnaccess.kneo.me/shop ================================================ ********************************************************************************************************* Utiliser mon lien de parrainage pour acheter un produit Tesla et obtenir des crédits gratuits : kilomètres gratuits en Superchargeur des vêtements et accessoires. https://ts.la/jeanpaul673722 *************************************************************************************************************

Excel VBA - Comment utiliser la boite de dialogue  InputBox
▶︎

Excel VBA - Comment utiliser la boite de dialogue InputBox

Excel VBA  - Comment utiliser le contrôle ActiveX de type ComboBox
▶︎

Excel VBA - Comment utiliser le contrôle ActiveX de type ComboBox

Fini la Saisie Manuelle sur Excel - Utilisez ce Formulaire Intelligent
▶︎

Fini la Saisie Manuelle sur Excel - Utilisez ce Formulaire Intelligent

[1/4] Formation Power Query — les bases à savoir !
▶︎

[1/4] Formation Power Query — les bases à savoir !

Power Query - Automate your column unpivoting with a dynamic list.
▶︎

Power Query - Automate your column unpivoting with a dynamic list.

Excel VBA - How to allow access to a sheet via a password
▶︎

Excel VBA - How to allow access to a sheet via a password

Listen and Feel the Peace | Tibetan Healing Sounds for Deep Meditation, Inner Peace & Soul Healing
▶︎

Listen and Feel the Peace | Tibetan Healing Sounds for Deep Meditation, Inner Peace & Soul Healing

God Says:"GET READY — ONLY I CAN STOP WHAT IS COMING"/God Message Now/God Message
▶︎

God Says:"GET READY — ONLY I CAN STOP WHAT IS COMING"/God Message Now/God Message

11-06-26 Sukhmani Sahib Full Path | ਸੁਖਮਨੀ ਸਾਹਿਬ ਪਾਠ | Sukhmani Sahib Da Path | Fast Sukhmani
▶︎

11-06-26 Sukhmani Sahib Full Path | ਸੁਖਮਨੀ ਸਾਹਿਬ ਪਾਠ | Sukhmani Sahib Da Path | Fast Sukhmani

Excel VBA | créer Tableau pour Filtrer Des Recherches Multicritères
▶︎

Excel VBA | créer Tableau pour Filtrer Des Recherches Multicritères

How to Create a Data Entry Form in Excel
▶︎

How to Create a Data Entry Form in Excel

VBA Rechercher PAR TOUT/ Plusieurs Critères/ Un Bouton OU plusieurs/Sans codage_20. www.VbaWriter.ch
▶︎

VBA Rechercher PAR TOUT/ Plusieurs Critères/ Un Bouton OU plusieurs/Sans codage_20. www.VbaWriter.ch

Duong Family Harvesting Giant Stream Fish to Make Rich-Flavored Smoked Salted Fish | Village Life
▶︎

Duong Family Harvesting Giant Stream Fish to Make Rich-Flavored Smoked Salted Fish | Village Life

EMPIEZA EL JUEVES CON FE | HOY DIOS TE DA PROTECCIÓN Y PAZ PARA TU FAMILIA | PADRE FREDDY BUSTAMANTE
▶︎

EMPIEZA EL JUEVES CON FE | HOY DIOS TE DA PROTECCIÓN Y PAZ PARA TU FAMILIA | PADRE FREDDY BUSTAMANTE

ALLES VIEL TEURER - gibt KUNDE die FREIGABE?? 😨
▶︎

ALLES VIEL TEURER - gibt KUNDE die FREIGABE?? 😨

LISTVIEW FILTRE + ICONES , Ajouter Modifier Supprimer  Rechercher | USERFORM EXCEL VBA .# 01
▶︎

LISTVIEW FILTRE + ICONES , Ajouter Modifier Supprimer Rechercher | USERFORM EXCEL VBA .# 01

VBA MAGIQUE/ Filtrer les données de ListBox par valeur du Combobox/ sans codage_15. www.VbaWriter.ch
▶︎

VBA MAGIQUE/ Filtrer les données de ListBox par valeur du Combobox/ sans codage_15. www.VbaWriter.ch

Unbelievable Workers | Working with Talented Engineers #46 #fail #adamrose #smartworkers
▶︎

Unbelievable Workers | Working with Talented Engineers #46 #fail #adamrose #smartworkers

Frequency Of God 963 Hz ✨ Attract Miracles, Divine Blessings & Deep Inner Peace In Your Life
▶︎

Frequency Of God 963 Hz ✨ Attract Miracles, Divine Blessings & Deep Inner Peace In Your Life

EMPIEZA EL MIÉRCOLES CON FE | SEÑOR, SANA A QUIENES SUFREN AHORA | PADRE FREDDY BUSTAMANTE
▶︎

EMPIEZA EL MIÉRCOLES CON FE | SEÑOR, SANA A QUIENES SUFREN AHORA | PADRE FREDDY BUSTAMANTE