public marks

PUBLIC MARKS from cascamorto with tag excel.vba

2022

excel - Sort Dictionary Keys using ArrayList - Stack Overflow

Option Explicit Public Sub Test() Dim wb As Workbook Set wb = ActiveWorkbook Dim ws As Worksheet Set ws = wb.ActiveSheet Dim rng As ListObject Set rng = ws.ListObjects(1) Dim arr() As Variant arr = Application.Transpose(rng.DataBodyRange.Value) Dim d As Scripting.Dictionary Set d = GetUnique(arr) Dim tempD As Scripting.Dictionary Set tempD = New Scripting.Dictionary Set tempD = SortDictionary(d) Dim key As Variant For Each key In d.Keys Debug.Print key, d.Item(key) Next key End Sub Private Function GetUnique(ByRef arr() As Variant) As Scripting.Dictionary Dim v As Variant Set GetUnique = New Scripting.Dictionary On Error Resume Next For Each v In arr GetUnique.Add v, v Next v End Function Private Function SortDictionary(dicObject As Scripting.Dictionary, Optional xlSortOrder As xlSortOrder = xlAscending) As Scripting.Dictionary Dim obj As Object Set obj = CreateObject("System.Collections.ArrayList") Dim v As Variant With obj For Each v In dicObject .Add v Next v .Sort End With Dim tempDic As Scripting.Dictionary Set tempDic = New Scripting.Dictionary Dim k As Variant For Each k In obj tempDic.Add k, dicObject(k) Next k Set SortDictionary = tempDic End Function

VBA ArrayList - A Complete Guide - Excel Macro Mastery

Contents : 1 Quick Guide to the VBA ArrayList 2 Description 3 Download the Source Code 4 Declare and Create the VBA ArrayList 4.1 Late Binding 4.2 Early Binding 4.3 VBA ArrayList Automation Error 5 Adding Items to the VBA ArrayList 6 Reading through an ArrayList 7 Sorting 8 Cloning the VBA ArrayList 9 Copying from an VBA ArrayList to an Array 10 Writing Directly to a Range 11 Array to a VBA ArrayList(1D) 12 Remove All Items from the ArrayList 13 What’s Next?

[vba] -- return an ArrayList from a function

Hello Paul Is there a way to return an ArrayList from a function, like a bellow? This is the code I have implemented Public Function ReturnArrayList() As ArrayList // or return type As Variant Dim alist As ArrayList Set alist = New ArrayList // Early Binding alist.Add “a” alist.Add “b” alist.Add “c” alist.Add “240” ReturnArrayList = alist End Sub Sub GetArrayList() Dim alist As ArrayList alist = ReturnArrayList() MsgBox alist(0) End Sub Thank you, Nishan Reply Paul Kelly Paul Kelly on December 24, 2019 at 7:56 am Hi Nishan, You need to use Set when returning an object.

2012

Programmer efficacement avec Excel en VBA

(via)
Dans cet article, nous allons étudier les techniques à suivre afin de programmer efficacement Excel en VBA. En effet bien que très pratique, l'enregistrement automatique d'Excel tend à créer un code de mauvaise qualité, ceci étant dû au fait qu'il enregistre les actions de l'utilisateur, et donc fonctionne selon un mode Sélection / Action. Or la sélection est rarement utile dans une Macro. De même nous verrons un certain nombre de techniques pour améliorer la vitesse d'exécution de ces programmes. Comme il n'est pas dans mon intention de faire un article explorant toutes les possibilités d'Excel, nous allons plus particulièrement nous pencher sur le domaine le plus utilisé du modèle objet d'Excel, c'est à dire les classeurs, feuilles et plages. Néanmoins j'aborderai aussi quelques autres parties. Il ne sera pas abordé la programmation des UserForms.

2011

Support de cours complet pour le VBA d'Excel

(via)
Nous allons dans ce cours voir ou revoir les bases de la programmation Visual basic et la manipulation du modèle objet de Microsoft Excel. Si vous n'avez jamais approché de près ou de loin un langage informatique, vous risquez de trouver le début de ce cours extrêmement complexe. Certains concepts évoqués au début de ce cours ne seront abordés que plus loin dans celui-ci. Lisez le une fois rapidement sans entrer dans le détail, cela devrait vous permettre de vous imprégner de la terminologie. Téléchargements : Télécharger formationVBA.pdf (226 pages - 3 Mo) - Téléchargement de secours

cascamorto's TAGS related to tag excel.vba

arraylist +   cours +   dictionary +   excel +   gratuit +   howto +   programmation +   sorted +   telecharger +   tutoriels +   vba +