public marks

PUBLIC MARKS with tags excel.vba & vba

2022

excel - Sort Dictionary Keys using ArrayList - Stack Overflow

by cascamorto
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

by cascamorto
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

by cascamorto
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.

2011

Support de cours complet pour le VBA d'Excel

by cascamorto (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

PUBLIC TAGS related to tag excel.vba

cours +   excel +   gratuit +   howto +   programmation +   telecharger +   tutoriels +   vba +  

Active users

cascamorto
last mark : 28/04/2022 17:40