Questions tagged [vba]

Visual Basic for Applications (VBA) is an event-driven programming language first introduced by Microsoft in 1993 to give Excel 5.0 a more robust object-oriented language for writing macros and automating the use of Excel. It is now used for the entire Office suite and over 200 non-Office hosts.

Filter by
Sorted by
Tagged with
0
votes
0answers
20 views

Beautify hybrid quicksort-Insertion for multi-key 2 dimension arrays VBA

Hi! This is just for fun, the speed of this algorithm is surely much more than what I need, but it's really engaging and stimulating try to spot out every possible improvement. And it also helps to ...
2
votes
1answer
55 views

Copy a contiguous sub-column of cells

This code searches for the word "Disbursements" and copies all of the rows with data below it, including the row with the specified word. After the rows are copied to a new sheet, the ...
-1
votes
1answer
45 views

Is it possible to make this macro faster? Copy and paste when condition is met [closed]

I have a problem with macro running too slow and I guess it is just because of lack of my knowledge. I have a macro that is copying data from "database" and paste it to another sheet. Macro ...
0
votes
0answers
30 views

VBA - create separate spreadsheets from a filtered table

The task is relatively simple and until now it was always performed by some poor admin soul. There is a large table that needs to be filtered based on a simple criteria and each view has to be saved ...
4
votes
1answer
29 views

Excel VBA Code for Imperial Length Measure Conversion and Formatting Yards Feet and Inches for English and Spanish

STR2INCHES is an Excel VBA Function that will convert string text for Imperial length measurements to a decimal number of Inches. It handles both English and Spanish words, abbreviations and symbols ...
3
votes
2answers
62 views

excel-vba function to filter an array and return an array

I have a function to filter a 2-d array. It works. But I am not sure if the following mechanism is a sensible concept. The idea is: loop over the input array which is received as ...
0
votes
0answers
57 views

Performance issue “not enough memory” Macro vba Excel - Parsing data

I have built some code that should parse the data according to a unique value and then create a new Worksheet for each unique value. My initial table has 10 Columns and around 25K rows. The code works ...
-1
votes
1answer
90 views

VBA how to speed up the code

Hey I have the following code written in VBA. It simulates trajectory of asset price (BS_trajektoria_2 function) and calculate payoff from option, This procedure is ...
7
votes
0answers
199 views

Private VBA Class Initializer called from Factory #2

About This is a follow-up of a previous question Private VBA Class Initializer called from Factory. I've decided to create a new question instead of answering my old question because I would like the ...
2
votes
3answers
46 views

Count the status messages in a column VBA

Can someone review my code and provide feedback. For context in column A will be a status message of "OK" or "NOK" and this little function just counts the number of times this ...
4
votes
0answers
134 views

Fast Native Memory Manipulation in VBA

I've been quite annoyed lately by the fact that the CopyMemory API (RtlMoveMemory on Windows and ...
2
votes
1answer
106 views

Different worksheets data comparison VBA is it possible without Application.WorksheetFunction.Vlookup?

I wrote this code to speed up my daily work. I want to ask for help on how to further accelerate this code. Operation of the code It copies 1-1 worksheets from 3 different workbooks to 3 worksheets of ...
2
votes
0answers
48 views

Modeling data from Excel sheets to parse to Excel sheet

Background: I have close to 50 excel files - I cannot change the data source - and I steadily get more. My task is to make sense of all that data and, lo an behold, save that as another excel file (I ...
2
votes
1answer
42 views

VBA, Transferring of Data from one File to another

I have this code that: Clears my worksheet from row 12 and onward in Workbook A Opens a new file Workbook B Copys the sheet to my Workbook A. and Close Workbook B Renames sheet in Workbook A ...
3
votes
2answers
53 views

internal links b/w sheets of merged workbooks, using VBA (EXCEL MACROS)

My aim is to merge all workbooks having multiple sheets from any specified folder to one workbook of multiple sheets. The problem is I don’t want external links to be maintained, If I use "...
1
vote
0answers
38 views

EscapeString Class for MySQL and JSON Using the Builder Pattern

This class is being used to build some complex strings JSON and MySql. Note: I'm not using the JSon converter because is difficult to create the structures the at that I want them and MySQL require ...
1
vote
1answer
79 views

Looking for a more condensed method of assigning values by using arrays and fixed ranges

I currently have a Template Workbook set up that has charts and graphs updating when new data is plugged into the Data Tables. The Data Tables are fixed ranges, and won't change. The Macro is within ...
1
vote
0answers
46 views

VBA Data dump code using transpose and timeline duplication

The below code ran in 2:26 which is way too slow especially as it's only 1/3rd of the total (the remaining 2/3rd does something very similar just on different sections). Is there something I can do ...
7
votes
1answer
205 views

Private VBA Class Initializer called from Factory

I've been playing with COM lately and while getting to understand the mechanism of how class methods/properties are called an idea came to mind: what if we can have a global instance of a class that ...
2
votes
1answer
150 views

Excel VBA code that displays a 14 day weather forecast

I am trying to see if anyone can help me in making this Excel VBA code a little faster in rendering the data from the weather site I am using. Maybe instead of getting all 14 days it includes in the ...
2
votes
1answer
62 views

How to speed up a treeview population in Access?

I have the following function that causes a significant visual jittering and lag in my access database - This is a treeview selection based on data in a table (tblDATA) with the fields: Object | ...
3
votes
2answers
107 views

How to get the median value faster

Using Excel, I have one sheet ("db") with data extracted from MES. I have to analyze this data and I need: Articolo, Fase, Tipo Confezione, TURNO, Macchina, avg and median. I searched ...
1
vote
0answers
47 views

Trying to speed up VBA macro to generate viable Daily Fantasy Sports lineups

I have created the code below to generate daily fantasy sports lineups from a pool of players that have been entered in my excel file. Right now the code can run through about 16,500 combinations per ...
10
votes
0answers
189 views

Host-Agnostic Model-View-ViewModel Infrastructure

I've written an API that unlocks some serious MVVM capabilities with VBA's MSForms UI framework. This is the complete code-behind for an example ...
2
votes
0answers
38 views

Bulk Email Sending Using VBA Run Time Concern

I have written a code for my purpose to send bulk email dynamically (Name,Document,Expiry date,email address will be changed dynamically)..Everything is working fine but it take a approximately ( 4 ...
2
votes
1answer
99 views

Output the rounded sum of each column in selection

I've written something (i.e. frankensteined from stack exchange) that appears to work but I haven't done much testing on the edge cases. Signed up here for some feedback on what optimizations or other ...
23
votes
0answers
303 views

Pacman implemented in OOP VBA

What?, Why? I have been inspired by several other posts on the topic of OOP implementations in VBA to try and create a Pacman clone. I think this task is not all that hard in most languages; but, I ...
3
votes
0answers
56 views

Taking time off of taking time off

In my ongoing quest to automate everything I have to do at my job, I've decided to learn how to do webscraping with VBA. I wanted to start with something easy, so the following simply fills out a ...
1
vote
0answers
56 views

Longer Macro getting stuck when opening Workbooks

I have a longer Macro has sub functions opening many different Workbooks, takes the data, and pastes into a Destination Workbook through arrays and .value. There ...
6
votes
1answer
101 views

VBA Error Handling Sub, Working for all subs

The idea is to make an error handling procedure, which prints messages in DEV mode and shows MsgBox in ...
1
vote
0answers
52 views

Ensuring secure API connection VBA

Earlier this year, I posted the following; Extract data from API using VBA & XML (Performance) The purpose of this project is/was to develop a small data extractor for our existing API to ensure ...
5
votes
1answer
113 views

Add Default Rubberduck VBA Folder Annotation to VBProject.VBComponents

Currently Rubberduck VBA files all the VBProject VBComponents in that do not have a Folder Annotation in a Folder named after the VBProject. It can be time consuming to manually organize the ...
7
votes
1answer
117 views

VBA-Sync code feedback

I was hoping to get some input on a class module I'm designing to abstract away the boilerplate of utilizing asynchronous queries in VBA. cQueryable supports both synchronous and asynchronous queries. ...
4
votes
0answers
40 views

Sheet display in function of date and time on open and save (2)

Since I had to almost start all of the code again with first refactor and an eye opening advice on a random Overflow question, here it is again: This is a code that selects the right sheet according ...
5
votes
1answer
95 views

Similarity between words

I'm writing a method that writes the code for a loading routine. Given an object from the database, I want to put its properties in the right control on a userform. I have the list of the properties ...
4
votes
1answer
41 views

Sheet display in function of date and time on open and save

Here's a simple one for u guys, The code is called upon workbook_open and BeforeSave, it displays the right sheet in function of date and time (Day vs night shift vs date). The code run trough the ...
3
votes
1answer
85 views

Creating a values only copy of an excel workbook without opening it

I have created a working VBA script that allows the user to select a workbook and make a values only copy of it without opening it. This is useful for getting data from a workbook that is very slow to ...
3
votes
1answer
81 views

Copy-Paste-Find-Replace (weekly update)

Heres a code that update weekly datas from production reports Known flaws : Im copy pasting the old line and replacing the week number in it to fit it to the one we want to update. The problem is ...
5
votes
3answers
83 views

Right-trimming text files

below vbscript code took me 3hours just to complete trimming whitespaces of a 24MB file any tips to speed up the process below? ...
2
votes
3answers
73 views

Better way to code this code snippet (copy paste)

I am trying to improve upon a VBA code created through recording a macro. Can the code below be optimized (I was informed to avoid .Select as much as possible)? The code itself works fine for me ...
4
votes
1answer
81 views

How to copy and paste a filtered range more efficiently

I have this bit of code that works for copy and pasting an autofiltered range. I just wanted to see if anyone knew a more efficient way to do so as it does take quite a while to complete it the way I ...
3
votes
1answer
76 views

Employee name auto-complete on card scan

Im currently running an employee name substitution on card scan. Overall the code takes the entry trough the gun scan, "scan" trough the hidden reference sheet to find a match and then input ...
3
votes
1answer
82 views

Workbook _open copy-paste reference sheet (30k+lines) from other workbook on change only

Working on finding a way to reduce in-cell formula size and memory usage of my excel workbook, i came up with the idea to "load" (copi-paste) the reference sheet i was mentioning a lot with ...
2
votes
1answer
63 views

VBA Sort-Compile-Write data from multiple worksheet on changes

I finished a code that sorts and compiles daily work data into a weekly summary. Its triggered by workbook changes so it refreshes automatically. Trying to respect "good code writing", and ...
6
votes
0answers
60 views

Shape Text Formatter Class a Builder Pattern

The preeminence is to have every method of the formatter return the formatter as a reference. This allows it to add and format text in chain. Such as: ...
4
votes
3answers
151 views

Excel Data Import and Manipulation

This code imports a list of equipment (around 8000), and then filters the errors and creates some lots for the processes that come next. The code is working, but I'm sure it can be improved, ...
2
votes
0answers
103 views

Copying Data from multiple workbooks -> Into One Worksheet (continuous data)

I have a macro created by my predecessor that I run on a monthly basis. However, it does take a while to get through, and I would like to clean it up for efficiency please. It copies data from ...
1
vote
0answers
103 views

Iteratively Exporting PDF Reports with Excel

The goal here is to notate and produce essential PDF reports. The For loop takes an id number and puts it into specified calculator worksheet. The workbook is set to automatic calculation so all of ...
6
votes
1answer
104 views

Creating a Chart Worksheet from scratch with VBA / OOP Design

I recently posted some code for review, and am now looking to gather some feedback on my latest implementation with that code. Yes, I have fallen into the OOP rabbit hole (thanks Mathieu Guindon) and ...
10
votes
3answers
408 views

Simulated WeakReference class

I've created a fake WeakReference class for VBA by chance. A Weak Reference is not counted (i.e. IUnknown::AddRef method is not called). I knew about the Weak Reference concept from Swift and I ...

1
2 3 4 5
25