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.

learn more… | top users | synonyms

-2
votes
0answers
11 views

Custom Title extractor Code in VBA Powerpoint. Misses data types, compatibility & package into Addin [on hold]

Need help on this project I've been working on. Its to enable extraction of titles/headings from large/many powerpoint presentations. The code is below and I'm facing three issues: 1) The essence of ...
1
vote
0answers
23 views

Transferring information between sheets based on column headings

This function conditionally copies and pastes information from one sheet to another based on the column headings to standardize data before exported to SQL database. I am not an expert in VBA and ...
6
votes
1answer
53 views

Porting ProcMonDebugOutput from C# to VBA

This code has one public method. ProcMonDebugOutput(). It will sent a string of text to Process Monitor that process monitor will display. I'm basically ported ...
7
votes
1answer
45 views

Unit test code for Antlr Grammar

I'm working on a grammar for the Visual Basic for Applications (VBA) programming language. I've discovered a way to make assertions about how a parse tree should be generated by using the Antlr ...
5
votes
2answers
58 views

Adding all IDs associated with a Fax to one Row

I found a custom function called UniqueItems() to use and then developed my own RemoveDups() and ...
5
votes
2answers
72 views

Copying data entry values in to a separate WorkFile

The code is working but slow. Is there a way to speed it up or make it more compact but still easy to read? There are 35 different jobs to be done. They are made in a worksheet with merged cells to ...
1
vote
1answer
58 views

Streamlining function that gets the length of each value

The code works well but before I added sections (13) and (14), it ran in 6 minutes and now runs in 16 minutes. If there is a way to streamline this to cut down the runtime, that would be ...
4
votes
1answer
73 views

Excel macro to move data across workbooks using an ADO connection

I am writing a macro to move data from a CSV to an excel template. Currently, I have the code set to search for a keyword in column A of the CSV, and extract data from specified columns in the ...
3
votes
2answers
147 views

Converting CSV files to Excel workbooks

My converter converts all CSV files in the subfolders of folders 1, 2 & 3 into Excel workbooks. As of now, I am converting using codes for each folders. I previously tried to combine those into ...
3
votes
1answer
50 views

VBA macro to move data across workbooks

I'm new to VBA and am trying to write a macro to move data from an exported file to an excel template. The code below works, however I have to add many more ranges of data and am worried it will be ...
6
votes
3answers
125 views

Extracting data from CSV file on the internet

This is my code I made that extracts data from a .csv file stored on the web. My sheet called 'New Data' stores this data for 2 days. I store 2 days worth of data so that when I run it next time, it ...
3
votes
3answers
172 views

Copying a range from one file to another

Since it has too many loop, loop inside loop, this works very slowly. How can we increase the speed of this program? I am trying to copy a range from one file to another file of same name in different ...
5
votes
3answers
229 views

Try catch statement in VBA using the standard VBA error handling statements

The code below is pretty self explanatory: just copy and paste it all into a module and run it, it provides a few use cases and many explanatory comments in the text. (It works but I'm interested to ...
5
votes
1answer
108 views

Retrieving ListBox.column values and store into objects

I know there must be a better way to perform the above sub than using multiple If statements. I was thinking of storing the ...
7
votes
3answers
183 views

Colorizing Excel cells with a date range filter

In a table there is a number of column (chambre) and a number of row (alveole). If these matches in a list in an other sheet then it checks if it the date is between two dates on that second sheets. ...
4
votes
2answers
217 views

Calculating how long sales reps are idle

I wrote a procedure to calculate the number of months elapsed since a sales agent' last sale. It works but runs in over 10 minutes... for 20 rows. ...
5
votes
2answers
96 views

Select and Paste Rows in a Different Location

I am working with the output from a chemistry instrument, in .xls format. The output contains up to seven blocks of data corresponding to different types of samples e.g. controls, unknowns, ...
4
votes
3answers
32 views

Copying data from an Excel sheet to Word

This code copies a specific range and a chart from an Excel sheet to Word. This code works fine but it is very slow. I have used delays(Wait) to work properly while ...
5
votes
2answers
174 views

Intense worksheet manipulations: what price did I pay for performance optimization?

The code bellow was refactored for performance improvements for another user on this site. Functionality, high level: Sheet1 - CodeName aIndex: used as the main reference to the structure of the ...
5
votes
3answers
96 views

Copying columns and formats on condition

I have made significant changes in the code and now it takes about 20~40 seconds to process each worksheet. This will conditionally copy column based on the column headers in sheet2 that match to the ...
4
votes
3answers
166 views

Sorting and color-coding based on variables

I have the following three macros all running in the same module. Each one is attached to its own button (3 buttons total). All three buttons take an average of 6-12 mins to run. As I am working on ...
5
votes
2answers
94 views

Searching a huge number of strings from Excel to a large number of Text files

I have written this code to get the input string from the spreadsheet and search the string across the text files and state whether or not it is found in the Excel sheet. Scenario: Excel (sheet1): ...
3
votes
3answers
105 views

Translation function - one word set to another

I have this Excel VBA function that takes three parameters. It is essentially a translation mechanism with the following parameters: A sentence which has to be translated. A range of words to look ...
7
votes
4answers
154 views

Looks at order data and arranges it to focus on order locations

I have a sheet that order a bunch of information on individual orders. Order numbers are in column A, other information is in columns B-P, and then product numbers are the headers for columns Q-DL. ...
5
votes
1answer
69 views

Open files, copy area under header, print to mastersheet

This loops through folder to open files and get important info from the columns of names "HOLDER" and "CUTTING TOOL" and printing all the info to one excel document, masterfile. It utilizes a ...
3
votes
1answer
49 views

Parameterized Query in Access SQL

I am a beginner in Access SQL. I am in need of writing a parameter query for Access SQL and found a few tutorials and links for that but that wouldn't satisfy my requirement. DB: Access DB This ...
3
votes
3answers
174 views

Clearing Pictures Code

The following code removes all pictures that are placed into Column A. When running the code however I have noticed it runs fairly slow. This will be attached to a command button that will be located ...
6
votes
3answers
137 views

Conditionally copy columns

I have this Excel/VBA code and here is what it does: I have 3 sheets, where first sheet has two columns that will be used (A,C). 2nd Sheet is just the raw data file that will be imported from ...
7
votes
1answer
100 views

Finding and pasting images into a specific cell

The below macro finds and pastes images into column A. While the macro works, it starts to slow down when running 500+ images. I am not too familiar with the VBA language, does anyone have any ...
5
votes
2answers
149 views

Copying from sheet to sheet if column headings match

Basically, I have three sheets in my workbook where only the second and third worksheets are being used. I want to copy columns from the second sheet to the third sheet only if the column headings ...
4
votes
2answers
199 views

Calculate grades based on pass/fail percentage

Our school grading scale is from 1..10 with one decimal. If you do nothing you still get a grade of 1.0. A passing grade equals 5.5. A 'cesuur' percentage defines at what percentage of correct answers ...
1
vote
1answer
50 views

Inserting row into named range code

I am writing a macro for an inventory management document. The point of the User Form is to allow the user to add a new item to each of 5 sheets (Daily Sales, Total Inventory, Deliveries, Income ...
3
votes
2answers
89 views

DAO recordset effiency

I have a form that consists of about 60 fields that all update when choosing a different customer from a drop down. I feel like my current way is not the best way as it takes about 30 seconds to ...
6
votes
2answers
294 views

Next revision letter

This is a fun one! I wrote some code to automatically get the next revision letter for a file by looking at the existing letter. It works, but I think there is room for improvement as far as ...
1
vote
1answer
53 views

Using a nonsense string to check if a call has completed, rather than timeout?

My question is whether or not this is a good practice, and/or if there is a more efficient way to do it. I have to access this Solidworks interop object and wait for it to return some value. The ...
10
votes
2answers
416 views

Handling try catch in VB6

I asked a question elsewhere on Stack Exchange and was given an answer by multiple people that checking for errors in-line was not a good practice. I have been using an ...
4
votes
1answer
80 views

SQL + VBA Populating Data in Cell Range

I currently have a code that is connecting to SQL database in VBA. The data is populating correctly. However, I was wondering if there is a way to condense the code below. I have 4 different columns ...
3
votes
2answers
61 views

From New Worksheet, AutoFill Dates, Delete Extra Columns, Save As Month and Year

I have created an inventory management sheet for a Lodge in Africa. The general conditions of the document are that it has to be easy to use, because the people who are using it are not very computer ...
4
votes
1answer
74 views

Improving performance of VBA data validation script in Access with large data size

I work in IT compliance and one of my main duties is ensuring the integrity of employee network accounts. Partial VBA script as currently used is shown below: ...
5
votes
1answer
276 views

VBA Text import and sort Excel

I have routine tasks which require pulling data from an obsolete SPC package and putting it into Excel. The SPC software will only export into a text file. I have put pieced together a script to ...
12
votes
2answers
182 views

A reusable ProgressIndicator

There was a Tweet from @ExcelEasy earlier this week, that linked to this article, to which I replied with a little challenge: @ExcelEasy well done! #Challenge: make a more #OOP one without using ...
7
votes
2answers
170 views

VBA Text Array - Scan two columns rather than one

I have some code which is designed to scan columns F and G for occurrences of words found in an array, the array containing text ...
5
votes
1answer
515 views

Working with group of checkboxes in MS Excel

I have the following checkbox as depicted by the image below: The checkboxes are in 3 groups. Confidentiality, Integrity ad Availability. When the first in is clicked, the Confidentiality turns Red ...
4
votes
1answer
79 views

Speeding up Access query with a calculated field calling a VBA function

At work I have a Microsoft Access database of employees with fields such as employee's manager, employees email, and employee ID. My duties include updating this database and validating entries ...
2
votes
1answer
69 views

Select Case w/Public Functions

I am looking to enhance my VBA skills and efficiency with the code below. It currently executes at about 20 minutes. I just recently learned how to use public functions but this project is very ...
2
votes
1answer
67 views

Comparing cells of two Worksheets

With the following Code I try to compare the content of two Worksheets. The first column contains a key that is unique and the following columns contain data that I want to compare (My data sets ...
5
votes
2answers
384 views

Look for keywords and copy to another sheet

I currently have a working code that does exactly what I want it to do, loops through a particular part of an excel document looking for certain keywords, then pasting those keywords into a separate ...
2
votes
1answer
66 views

Loop through folder names on a server directory

I have the following code to loop through a directory of folders and print all folders names with their paths in a worksheet. This is a follow up question to this one: Excel VBA - Get Folder Names ...
2
votes
2answers
75 views

Excel .find Macro to write data to archive

I would like to speed up this piece of code. The macro gets a search variable from the worksheet "RAW_DATA_ARCHIVE" and then it should find it in the worksheet ...
3
votes
2answers
395 views

Excel VBA - Get Folder Names

I need to get folder names with the path for which I need to search the directory in a server with about 6000 folders. I have the following snippet of code to run through the folder and get the folder ...