Questions tagged [excel]

Microsoft Excel is a commercial spreadsheet application written and distributed by Microsoft.

Filter by
Sorted by
Tagged with
13 votes
1 answer
2k 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 ...
user avatar
  • 1,961
7 votes
1 answer
321 views

Comb Sort in VBA

Playing off Robust Bubble Sort in VBA and as suggested by @Henrik, I took a look at comb sort and tried to create an algorithm based on the documentation solely on Wikipedia. Basically, the first ...
user avatar
  • 7,109
1 vote
2 answers
447 views

Retrieve data from eBird API and create multi-level hierarchy of locations

As you may know, I like birds. The Cornell Lab of Ornithology has a tool called eBird where you can submit records of the birds you identified. I recently learned they have an API that I can query, ...
user avatar
  • 7,109
5 votes
2 answers
126 views

Parsing cells containing Line Feed Characters

Link to sanitized xls on dropbox if test data is needed Essentially the reports I work with aren't bad - The issue is the way it exports to excel - With the problem being that these cells are ...
user avatar
  • 7,109
6 votes
1 answer
427 views

Non-standardised data across multiple worksheets: Aggregation, Validation, Filtering

Every piece of business that gets written (E.G. an adviser's client puts an additional £10k payment into a pension plan) goes in a spreadsheet called the SubSheet. It's split into 8 worksheets for ...
user avatar
  • 8,800
6 votes
1 answer
492 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 ...
user avatar
  • 7,109
4 votes
3 answers
258 views

Brute force looping & formatting Or Create Union range & Format? Which is efficient and when?

May be my question is not up to the standard for Code Review, but of upmost importance for reassessing methods used in my VBA coding . While preparing/testing answer for a SO post (thought to simplest ...
user avatar
  • 278
3 votes
2 answers
101 views

C# Tool to Generate MS Word Document Mailbox List From MS Excel

There is now a Follow up question to this question. Abstract The VBA solution didn't work on the clients computer because Office 2010 Starter Edition doesn't support VBA. I decided to try a C# ...
user avatar
3 votes
3 answers
108 views

Follow Up: Refactored C# Tool to Generate MS Word Document Mailbox List From MS Excel

Background Some very good observations were made about my original code in the 2 answers to this question. In this version I have attempted to reduce cyclic complexity and class coupling even more as ...
user avatar
2 votes
1 answer
459 views

Part 2: Send HTTP request for each row in Excel table

This script was previously reviewed here: Send HTTP request for each row in Excel table (Part 1) I've made the changes that were suggested in the Code Review answers as well as added a few of my own. ...
user avatar
  • 198
8 votes
0 answers
3k views

Responding to Events of Dynamically added Controls

I was asked for an example of a class to wrap dynamically added controls as I suggested in this Answer. Although it is out of the context of a Code Review, I thought that it would make an interesting ...
user avatar
  • 4,028
20 votes
1 answer
5k views

Importing data from an external EXCEL-Sheet

I was assigned the task of copying some subsums from a given EXCEL-Sheet into the executing EXCEL-Sheet. This had to be done with an EXCEL-Macro, so non-programmers can easily use it. There was the ...
user avatar
  • 25.1k
7 votes
0 answers
860 views

IndexedArray Class: Uses a Dictionary Keys to Index a 2 Dimensional Array of Values

This class encapsulates a 2D Array and a Scripting Dictionary. Values are add or returned from to the Array using a Key and a ColumnIndex, e.g. ...
user avatar
  • 4,028
7 votes
2 answers
9k views

Traversing and printing complex Dictionary types (Scripting.Dictionary) - Dictionary inside of a Dictionary

Based on this SO post - also reposted on vba4all.com with a few more details and explanations. Please notice there currently is no error handling whatsoever as I didn't analyse and consider any traps ...
user avatar
6 votes
2 answers
213 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 ...
user avatar
5 votes
1 answer
434 views

Managing Excel Tables (ListObjects) with OOP Approach

Objective: Manage what happens when users interact with Excel Tables (ListObjects) Possible interactions: Update an existing Excel table Add rows/columns to the table Update a cell or a range of ...
user avatar
12 votes
3 answers
734 views

Perf wrapper for Excel VBA

Spoiler This code is actually BAD for performances! So don't use it! ;) For a while now, I've been using this wrapper to avoid retyping most of it : ...
user avatar
  • 359
8 votes
1 answer
174 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 ...
user avatar
  • 8,800
3 votes
3 answers
6k views

Change filename of Excel-files based on the content of a cell

I have hundreds of Excel-sheets looking something like this: I can't use the actual sheet, and not the exact document numbers, since they are confidential. The name of the files are something like ...
user avatar
2 votes
1 answer
68 views

Making a report from payroll details part II

Thanks for the help so far! Especially all of the people who helped out on part I - seen here. Making a report from payroll details Here's the revisions to the code based on feedback from that thread....
user avatar
8 votes
3 answers
331 views

If ComparisonIsTrue(thisPost, ComparisonOperator.NotEqualTo, goodCode) Then Me.Answer

This is a follow-on to a global enum for comparison operators. I wanted to pass a logical expression E.G. >= someValue as a parameter to a function, so I made an ...
user avatar
  • 8,800
8 votes
2 answers
373 views

Making a report from payroll details

...
user avatar
4 votes
0 answers
287 views

Looking for more efficient VBA to Move data from Teradata to Excel

I have a simple macro moving data from Teradata to Excel. The process normally takes me 10 minutes to perform manually, however the macro can run for hours sometimes. This is making the macro seems ...
user avatar
  • 51
4 votes
0 answers
105 views

Comb Sort Multi-dimensional Array on Key

Previously: Comb Sort in VBA I've been running two different comb sorts (on arrays) depending on whether I want to sort numbers or strings and I figured I would give using ...
user avatar
  • 7,109
4 votes
0 answers
128 views

Print apartment mailbox lists from excel

Update Due to the fact that the client's version of excel does not support VBA, I have moved on to a C# excel interop solution which has been reviewed. The test data has been added at the bottom. The ...
user avatar
4 votes
2 answers
123 views

User interface for a simple tool that generates Word documents from Excel data

This question provides the code behind the dialogs in the C# refactoring question. I'd like a review of this code as well. I'm not currently using databinding anywhere, and there is really only one ...
user avatar
3 votes
2 answers
358 views

Retrieve, total and display ingredients of meal

Here is the first iteration of this project on CodeReview Note: The input meal is data verified - it cannot be something that doesn't exist on the lookup sheet. ...
user avatar
  • 7,109
3 votes
1 answer
213 views

VBA syntax that compiles sub data into master sheet

I am using this syntax to bring in the names of all employees whom are active, then from there filter the data on subsequent worksheets and use a formula to bring the data over to the ...
user avatar
3 votes
1 answer
583 views

Managing Excel Tables (ListObjects) with OOP Approach (Follow up)

This is a follow up to this question Objective: Manage what happens when users interact with Excel Tables (ListObjects) Code incorporates: Greedo's answer suggestions: Listen to an encapsulated <...
user avatar
1 vote
0 answers
78 views

ContactEditor - Excel VBA db app: Storage Library

ContactEditor uses Excel VBA as a prototyping platform for a personal information manager combining the "Model, View, Presenter" (MVP) pattern and a persistent storage manager. Fig. 1. Data ...
user avatar
  • 375
1 vote
1 answer
94 views

Changing the formatting of sheets

This my program to change the formatting of sheets in different folders. I have over 5000 files in one folder and it is taking up to three hrs for one folder and there are multiple subfolders in the ...
user avatar
1 vote
1 answer
176 views

Looping through with varied subtotal ranges

I've got an issue where my looping through the rows on my sheet are extremely slow. For 20,000 rows, it takes about 20 minutes, whereas before, it was taking 3. The only pieces I added were at the ...
user avatar
12 votes
3 answers
6k views

Parameterised Constructors

Finally, Parameterised Constructors are possible in VBA. Background: One rainy day, I came up with an idea: take a static class and expose one property as default (like it was done in the Reverse for ...
user avatar
13 votes
1 answer
828 views

Tick. Tick. *breathe* BOOM! - Setting up real, stable asynchronous callbacks with WinAPI Timers in VBA

WinAPI Timers can be quite tricky to work with, as anyone who's tried to use them and fallen foul of one of the many pitfalls probably knows. Problems such as screen freezing, crashes, uncontrolled ...
user avatar
  • 2,160
8 votes
1 answer
1k views

Space Invader Style Game Written In VBA

EDIT: Link to the github, https://github.com/Evanml2030/Excel-SpaceInvader THE README (APPLIES HERE TOO): VBA version of a classic game Yes, I know that "Missile" is repeatedly written as "Missle"...
user avatar
11 votes
1 answer
715 views

Standard Methods in VBA [closed]

Since I learnt about refactoring, I've been busy creating my own Module of Standard Methods. I feel it's about time they got a review of their own. Open to all aspects of advice but particularly ...
user avatar
  • 8,800
14 votes
1 answer
117k views

Reading data from Excel sheet with ExcelDataReader

Objective: I want to import an Excel file, and read the rows of certain columns. For this, I use ExcelDataReader. I've implemented a low-level class called ...
user avatar
7 votes
2 answers
501 views

Excel display driver class for Tetris

This is the first of (hopefully) several posts as I reimplement an ancient (and unfortunately long lost) Excel VBA Tetris clone. The main workhorse class in the game engine is the display driver, ...
user avatar
  • 4,202
5 votes
0 answers
1k views

Multithreaded Excel + VBScript Timer: Snake Game Demo

Multithreaded Excel + VBScript Timer After reviewing these post: Snake in Excel in… VBA? and Drawing a snake using arrow keys in Excel using VBA, I decided to work on creating a VBA Timer. The ...
user avatar
10 votes
1 answer
431 views

Produce a Linear Cut List for Woodworking

I was inspired to write this by a recent review of cutting pipes. The only thing I'm really iffy about is using the WriteCuts method. I couldn't figure out a way to ...
user avatar
  • 7,109
9 votes
2 answers
2k views

Text file to spreadsheet

Lets say you have several .txt files in a folder and want to merge all text files into a single Excel document: A.txt ...
user avatar
  • 2,986
7 votes
2 answers
114 views

VBA macro - searches through a filtered table, stops when entry passes criteria

I have written several subs which are then called from a main sub. Individual subs run very quickly, most are instantaneous (the DoFind sub takes a few seconds to run due to the large amounts of data ...
user avatar
  • 103
6 votes
1 answer
59k 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 ...
user avatar
21 votes
1 answer
25k views

Snake in Excel in... VBA?

snake-game is a game where you control a snake in an enclosed square without running into the walls or your own body. The snake grows when you run into whatever item you are supposed to run into. My ...
user avatar
  • 7,109
11 votes
1 answer
634 views

Copy, Paste And Format

I am currently working with this code to automate some tasks for senior staff members that are not very adept in Excel. Wondering if VBA is simply not a very quick code or if my code is clunky and ...
user avatar
10 votes
2 answers
413 views

Financial Data From Webqueries in Excel

I'm new (to CR and to programming in general). I wrote my first VBA on Monday. This is my first working project. It Takes a bunch of financial data from a company called Financial Analytics and a ...
user avatar
8 votes
0 answers
127 views

A VBA program to quantify the performance of code execution timers

Motivation I am interested in optimising the execution time of code with short (fast) execution times on the order of microseconds (µs), but that will be used with high frequency (e.g. like ...
user avatar
  • 181
8 votes
2 answers
3k views

Converting Data in Rows and Columns to Rows in VBA for Excel

I have a working VBA script for Excel that converts a matrix of data with multiple records in per row to multiple rows with one record per row. A StackOverflow user told me that the code could use ...
user avatar
  • 247
7 votes
3 answers
3k views

Retrieve value from a formula in cells into different merged cells and retrieved value can be edited

I have created this macro and having a small issue. I am very new to this VBA and did this with experts’ guides by googling it. I am creating an excel form for a work purpose at work. The Excel form ...
user avatar
  • 71
5 votes
1 answer
151 views

Filter a two dimension array

This is the function I've wrote to filter a two-dimension array. I use it mainly on forms with user-defined filter (categories, dates, search bar, etc). It works fine, but it's ugly. Do you have ...
user avatar
  • 354