Progress Bar in VBA-Excel Macros

How to Create a Progress Bar in Excel?

Here, you will find a step-by-step tutorial on how to install and use a progress bar for your VBA Excel projects.

Progress Bar Excel VBA


When you finish, you will be able to use this progress bar in any file, macro, or code you want just by calling the functions inside the modules.

1) First, you have to download the Userform (both files: ProgressBar.frm and ProgressBar.frx) from my GitHub folder, in this link. From the same folder, you have to download the ProgressBarModule.bas file.

2) Once you have the three files, you have to import them all into your Excel Macro-Enabled file.

3) In your Excel file, you can use the functions from the ProgressBarModule: StartBar, IncreaseBar, CloseBar, Subtitle.

4) You can download the Excel file example from this GitHub repository.

Here is the code of the Function Example():

									
Function Example()
    Dim dMax As Double, f As Double
    dMax = 12345
    
    ProgressBarModule.StartBar dMax, "Here we write a title..."
    For f = 1 To dMax
        ProgressBarModule.IncreaseBar
        If f < 1000 Then
            ProgressBarModule.Subtitle "Subtitle: less than 1000.."
        ElseIf f < 3000 Then
            ProgressBarModule.Subtitle "Subtitle: less than 3000.."
        ElseIf f < 5000 Then
            ProgressBarModule.Subtitle "Subtitle: less than 5000.."
        Else
            ProgressBarModule.Subtitle "Subtitle: more than 5000.."
        End If
    Next
    ProgressBarModule.CloseBar
End Function
										
									

FIFA World Cup Qatar 2022 Sticker Collection

How much does it cost to fill out the Qatar 2022 World Cup Album in Argentina?

Album Qatar 2022


To answer this, I wrote an algorithm with Python that simulates hundreds of cases, and gives us: How much is the least you could spend to fill the album?

Here is a part of the code.

You can see the complete version in GitHub, in this link

									
# figuritas_roman.py

import random
import numpy as np

def nuevo_album(fig_en_el_album):
	return np.zeros(fig_en_el_album)

def esta_incompleto(A):
	return 0 in A

def nuevo_paquete(fig_en_el_album, fig_en_paquete):
	return random.choices(range(fig_en_el_album),k=fig_en_paquete)

def paquetes_necesarios(fig_en_el_album, fig_en_paquete, cambiazo):
	album = nuevo_album(fig_en_el_album)
	comprados = 0
	while esta_incompleto(album):
		comprados +=1
		paquete = nuevo_paquete(fig_en_el_album, fig_en_paquete)

		for p in paquete:
			album[p - 1] = 1
	return comprados

def test_paquetes(n, fig_en_el_album, fig_en_paquete, cambiafigu = False):
	Tests = [paquetes_necesarios(fig_en_el_album, fig_en_paquete, cambiafigu) for i in range(n)]
	return np.mean(Tests)

									
									

Algebra functions made in Haskell

Functions and exercises that I wrote in the Algebra Workshop at the Faculty of Exact Sciences (UBA)

Haskell


Below are some examples, and the full codes can be seen in GitHub, in this link

									
# functions.hs

division :: Int -> Int -> ( Int , Int )
division a d
 | a < 0 = (-q-1, d-r) --Si el primero es negativo
 | d < 0 = (-q', r')   --Si el segundo es negativo
 | a < d = (0 , a )
 | otherwise = ( fst ( division (a - d ) d ) + 1, snd ( division (a - d ) d ))
 where (q,r) = division (-a) d 
       (q',r') = division a (-d) 

mcd :: Int -> Int -> Int
mcd a 0 = a
mcd a b  = mcd b (snd (division a b))


todosLosDivisores :: Int -> [Int]
todosLosDivisores x = todosLosDivisoresAux x x
--todosLosDivisores x = 1 : auxiliarDivisor x 2

todosLosDivisoresAux :: Int -> Int -> [Int]
todosLosDivisoresAux x x'
 | x == 0 = []
 | x == 1 = [1] 
 | mod x' x == 0 = x : (todosLosDivisoresAux (x-1) x')
 | otherwise = (todosLosDivisoresAux (x-1) x')

auxiliarDivisor :: Int -> Int -> [Int]
auxiliarDivisor x y 
 | x == y = [x]
 | mod x y == 0 = y : auxiliarDivisor x (y+1)
 | otherwise = auxiliarDivisor x (y+1)

mayorDivisorComun :: Int -> Int -> Int
mayorDivisorComun a b = elemento_comun ((todosLosDivisores a)) ((todosLosDivisores b)) 

elemento_comun :: [Int] -> [Int] -> Int
elemento_comun as bs 
 | elem (head as) bs = head as
 | otherwise =  elemento_comun (tail as) bs
									
								

UNSAM: Python Programming Course

Complete project that I wrote during the Python Programming Course, of the Universidad Nacional de San Martín

Python UNSAM


Here you will find the entire official program and the details of the Seminar

The course was taught by two ECyT-UNSAM professors who are also CONICET researchers: Oscar Filevich has a degree in Biology, a PhD in Chemistry and works in neurophysiology; Rafael Grimson has a degree in Mathematics, a PhD in Computing and works on environmental issues.
Manuela Cerdiero also served as a teaching assistant and Iván Pedrón and Daniela Alban as assistants. In addition, Matias López-Rosenfeld was guest professor, and José Crespo and José Clemente, visiting professors.

Below are some examples, and the complete code for the project, written in Python and using several libraries, can be seen in GitHub, in this link

									

# fileparse.py

import csv

#%% ejercicio 7.6
def parse_csv(lines, select = None, types = None, has_headers = True, silence_errors = False):
    '''
    Parsea un archivo CSV en una lista de registros.
    Se puede seleccionar sólo un subconjunto de las columnas, determinando el parámetro select,
    que debe ser una lista de nombres de las columnas a considerar.
    '''
    if select and not has_headers:
        raise RuntimeError('Para seleccionar, necesito encabezados.')
    filas = csv.reader(lines)

    # Lee los encabezados del archivo
    if has_headers:
        encabezados = next(filas)
    else:
        encabezados = []

    # Si se indicó un selector de columnas,
    #    buscar los índices de las columnas especificadas.
    # Y en ese caso achicar el conjunto de encabezados para diccionarios

    if select:
        indices = [encabezados.index(nombre_columna) for nombre_columna in select]
        encabezados = select
    else:
        indices = []

    registros = []
    for n_fila, fila in enumerate(filas, start = 1):
        if not fila:    # Saltear filas vacías
            continue
        # Filtrar la fila si se especificaron columnas
        if indices:
            fila = [fila[index] for index in indices]
        
        try:
            if types:
            
                fila = [func(val) for func, val in zip(types, fila)]
                
            # Armar el diccionario
            if encabezados:
                registro = dict(zip(encabezados, fila))
            else:
                registro = tuple(fila)

            registros.append(registro)
        
        except ValueError as e:
            if not silence_errors:
                print(f'Fila {n_fila}: No pude convertir {fila}')
                print(f'Fila {n_fila}: Motivo: {e}')
                
    return registros