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

5
votes
2answers
51 views

Function to return a string legal for a range name

I wrote an Excel VBA function that will take a string argument and return a string that is legal for naming a range. Upon looking through this, if you're wondering what I've been smoking, I should ...
-2
votes
0answers
15 views

vba- parse xml that i go from webserver and write it to excel takeing to much tim [on hold]

I am trying to write to a excel more 50000 rows that etch row have 11 cells it;s taking me more them 18 minutes to do so. can somebody tell me what am I am doing wrong?? I am seeing that most of the ...
2
votes
2answers
71 views

Copying rows from one workbook to another

This code will copy data from a workbook and copy it to an existing (and open) workbook. At the beginning of the month this copy/paste works very quickly, but as the month goes on and the data also ...
3
votes
2answers
48 views

Data Table Report Class

Most of the VBA I write is to produce tabulated reports from spreadsheet data. So, here is my attempt at creating a CLS_Data_Report class. Properties: a ...
4
votes
1answer
57 views

VBA code for testing efficency

I am currently trying out code for timing efficiency (how fast it runs, basically). The general consensus is that code with ActiveCell,...
2
votes
2answers
23 views

Outlook VBA-Macro for to check mails concerning recipients and attachments

Every week I've got to send a report to a clerk. I also have to add his deputy in case the clerk isn't available. For not to forget the second recipient and the attachment I've wrote myself this ...
5
votes
3answers
67 views

Simple Caesar Cipher Function

For no particular reason, I wanted to create a function that would take a string and "encrypt" it via Caesar cipher. This function takes a string and shifts the letters left or right (in the alphabet) ...
6
votes
2answers
206 views

VBA Excel - Conditional Formatting Colour Grab

This code gets the cell's colour regardless of whether it's set from conditional formatting or not. It currently works on 2010 and unsure about older versions of excel. My question is is there a way ...
4
votes
1answer
44 views

Highlighting and copying spreadsheet rows that match a criterion

I use the code (provided below) to check for certain criteria in a row. In this case, if cell F in worksheet "Swivel" contains "After Dispute For SBU" then that row needs to be highlighted in yellow ...
4
votes
1answer
31 views

A global Enum for comparison operators

This approach was born out of wanting to pass a logical expression (E.G. ">=10000") as a parameter to a function. So, I built an Enum and a function to use it to evaluate logical expressions. Is ...
6
votes
1answer
43 views

Looking up ingredients and creating a shopping list

This is my first attempt at refactoring - FindIngredients and I'm wondering where I can improve. The github link in the code directs to the project that still has ...
6
votes
3answers
87 views

Copying data from closed workbooks

I'm an intern in an industrial company in Brazil and it happens that I'm using excel a lot. I just started playing with VBA couple of days ago, and I'm amused of how many things it can do for me! I ...
4
votes
2answers
52 views

Structure for Multiple Potential Find Errors

I have been writing some code to add to our company's Bill of Materials template Excel file. Every project that we do has its own unique Bill of Materials. I am attempting to make it more dynamic and ...
5
votes
1answer
46 views

Get Worksheet Data Array (Standard Methods)

I'm re-writing my module of Standard Methods. Virtually every project I do begins with grabbing some number of Data Tables and putting them in arrays. So, this is my general "Get Worksheet Data" ...
4
votes
2answers
38 views

Transforming and quantizing some numbers in a spreadsheet

I have two functions which am currently running separately and would like them to run at once. The cartMaxCalc calculates and populates column ...
7
votes
1answer
70 views

VBA Class to persist and restore Excel Application properties

Very often on Stack Overflow, and even on Code Review, I've seen questions and answers that have code that begins by persisting Excel properties like DisplayAlerts ...
6
votes
1answer
49 views

Create a folder and perform a SaveAs

I have this code that is working as intended. Since I am still learning VBA and coding, I was wondering if anyone could look at this at let me know if there is another way to write this. This is part ...
3
votes
4answers
82 views

A function that implements a query

I have some parameterized queries in Access 2010. They are often used in VBA functions having the same parameters. In such cases, I give the query and function the same name. The following is such a ...
8
votes
2answers
124 views

Report Building (Data Retrieval, Validation, Aggregation, Business Logic, Report Building, Visual Presentation)

This: Is a data table we get from our financial platform with lots of useful information. For reference, "--" is also the string they use to denote empty values. This: Is a spreadsheet I built ...
3
votes
1answer
53 views

Perform loop through process on all sheets at once

I have workbook having multiple sheets and having same data on it. Currently I am using macro that .autofilterand copy paste on respective sheets. I am using looping process like:- ...
3
votes
1answer
26 views

Inserting and Populating Chart with Excel VBA

My Code uses a data set which has been modified using another script Calculating Time Difference and then inserts and populates a Chart with that Data. Save a Macro enabled WorkBook as Book1.xlsm ...
5
votes
1answer
57 views

ExcelVBA loop exports data from spreadsheet to table within Excel

I want to nest a for loop to cycle through the Range.Value but ("B4") throws me off and this can't be avoided. I was considering using an array to do this but ...
3
votes
1answer
74 views

Refactor of vba function to reduce bloat and repeated code

This takes in an array of data built from a source workbook, builds a set of "flags" based on the data in each row of the array. Then it creates a new finalRng ...
3
votes
1answer
35 views

Calculate Maximum Time Difference Within a Time Period with Max 30 Minutes Difference

For ease of Reference, Sample Data Set which needs to be pasted into Column C from row 20. You can paste the text below into word and then copy from word into Excel with the Cell format set to Custom: ...
2
votes
1answer
42 views

Maintaining row height while inserting

I have a subroutine which re-formats cells after a heading is inserted into the document. Most cells are 12.75 points high, whereas the headings are 15 points high. When a heading (single line) is ...
3
votes
4answers
282 views

Deleting rows from a spreadsheet where Column C is blank

I have a script which I use to delete rows from a Excel Sheet, dependent on the Column C cell of that row being blank. I believe deleting a range might be quicker than deleting individual rows, but ...
8
votes
3answers
103 views

Clearing duplicates from an Excel 2007 sheet

This is the original code I had for removing duplicates from a sheet: ...
5
votes
3answers
72 views

Class Module to wrap up classic ADO call to SQL-server

I do a lot of copying excel vba code related to classic ADO from workbook to workbook, so I've decided to add the code to a Class Module in a single utility workbook and then in all other books just ...
3
votes
1answer
29 views

Converting Hindi Devanagari proprietary font to Unicode font

This working macro converts Hindi Devanagari proprietary font to Unicode font. It reads the conversion table from a tab delimited file, and converts one by one by finding all matches and then does ...
4
votes
1answer
52 views

Move zipped files from multiple subfolders into one master folder via loop process

I am trying to write a code that: First Prompt: asks the user to select the folder that contains all zipped folders where each zipped folder contains a data file. Second Prompt: Ask the user to ...
5
votes
1answer
47 views

Concatenate data files into master document

Here is code I wrote to concatenate data files into master file. Once the data to be pasted into the master sheet exceeds the number of rows left in the master sheet, the program will create a new ...
19
votes
2answers
168 views

Life is a Game - Play it

I haven't made a game in Excel yet, so I decided to Make Conway's Game of Life. If you wish to play along, I've uploaded the workbook here. Right now it's very rudimentary (No user interface, no ...
7
votes
1answer
36 views

Data table retrieval and indexing (+ interfacing between workbooks)

This project utilises the external-workbook-retrieval methods found here for the second workbook. This is the beginning of a project. The code here covers: Initial setup (define workbooks, unmerge ...
8
votes
2answers
95 views

Function to find the kth match (2)

code from suggestions in comments here. I will still write it like the first time, so you do not need to read the old question. I've created a UDF some time ago and used it pretty often till now in ...
10
votes
1answer
57 views

Function to find the kth match

I've created a UDF some time ago and used it pretty often till now in different ways (but mainly to compare a "history" of data like having different filters at the same time). While there is no need ...
9
votes
1answer
165 views

Multi-dimensional array sort and filter functions

As I said in my last post Multi-dimensional ascending and descending sort array function, I'm back with the final version of the code. Added features: Filter array function by following parameters: ...
-1
votes
2answers
131 views

Delete rows quicker [closed]

I have worked on some VBA code for past couple of days and everything seems to be working fine till one fine day when I added the below code to it. The execution time increased to such an extent that ...
14
votes
1answer
111 views

Module for implementation in multiple version-controlled spreadsheets

So I maintain a large number of spreadsheets which are stored on a version-controlled server. In each spreadsheet maintained on this server there is a module containing the following code, which is ...
11
votes
2answers
77 views

Extract values within date and zone ranges

In order to automate a manual task I created the following code. As I've never written a program to this size, I'm curious if my use of variables, as well as, solutions are the most optimal way for ...
11
votes
4answers
161 views

Get Workbook Method(s)

I'm re-writing my Module of standard methods. These 3 are used to retrieve Workbooks as Workbook Objects. The standard I'm aiming for here is "Third-party Library/Add-in". So: Do these functions ...
0
votes
2answers
73 views

Macro to format a specific worksheet

I am still new to VBA. I recorded several actions that I need to perform to ensure that a specific worksheet is formatted properly. Row 1 contains headers. Other than the headers, there is no data in ...
6
votes
1answer
41 views

UserForm to handle Date Inputs (Day,Month,Year)

Some fraction of a follow-up to The half-finished version. What's changed: Added year as well as Day/Month. Added input Validation. Implemented a poor man's ...
6
votes
1answer
89 views

Populating Day/Month Selections in UserForm Controls

So I have a simple userform where I require the User to input the target month, and the day to analyse data up to. This is just a small section of code to govern populating the month selection and ...
7
votes
2answers
78 views

Find value from other dataset based on 6 variables that must be equal in both datasets

I have two datasets that are both within a worksheet, call them Data and IBES. The code checks whether the 6 variables are the same in each dataset and then writes the value from a specific column to ...
5
votes
2answers
76 views

Raw exchange trade data analysis program

The following is a small snippet from a pretty large program written to analyze raw data and find specific trade structures. I am new to VBA and this is my first large scale program I have written in ...
3
votes
1answer
55 views

Interfacing between workbooks (Exporting data Table and key properties)

So I recently rebuilt a worksheet we have for tracking our clients who take income from their portfolios (here). I intend to be pulling this data into other workbooks for various reporting functions. ...
7
votes
1answer
88 views

Custom sorting an Excel Data Table (+ visual formatting)

I'm (re)building a data table to track our clients that receive regular income payments. Specifically, I need to pull this data into other workbooks for other reports, and since I was here anyway I ...
9
votes
1answer
121 views

Import multiple XML files into Excel

I have adapted a VBA code to import all the XML files I have on a folder into Excel. I have tried to run the code with only two files and it takes about 30 seconds. Several minutes to import less than ...
9
votes
2answers
212 views

Using VBA to “apply names” to named range references

So there's a known bug in excel where applying named ranges via ribbon doesn't work properly (for 2010 and 2013 and possibly 2016). There was a question about it on superuser - Apply names in excel ...
5
votes
2answers
115 views

Project Euler #1-3 in VBA

Self explanatory, and all the functions contain descriptions of their specific problem statements. Since this is project Euler, I would be particularly interested in any analysis of the ...