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
15 views

Split word file in multiple word documents by renaming each generated .doc documents VBA

hope that Everyone is doing fine. I have a word document containing some text (see below). I would like to split the document in multiple word documents with a specific name for each document ...
4
votes
0answers
66 views

Extract data from API using VBA & XML (Performance)

EDIT: Added a block with the raw code at the bottom (suggested by a friendly user) First post here. I sincerely hope that I am doing everything by the book. Also, I want to thank you in advance for ...
2
votes
1answer
57 views

SheetChange event VBA

I would like to ask for a code review as I feel like it's not the most efficient way of doing it. For context I have a add-ins with all the code in module and then the ...
1
vote
1answer
45 views

Altering spreadsheet data

I have the below code that helps me do some formatting. But I want to increase the efficiency of the code by making it faster. Below are the formatting steps of the macro. Convert "Q" and "S" column ...
-1
votes
0answers
27 views

Avoiding select with layout code

I have the following code that does a layout change in a range of cells in Column S. The code works fine, but can be a lot more efficient. I want to learn how apply the code below without select. I've ...
3
votes
1answer
104 views

Array manipulation object

I'm trying to write a class that simplifies the most common operations with arrays and then I want to distribute... Maybe it can help someone... But I'm facing some problems in make the object ...
2
votes
1answer
36 views

Loop through a worksheet and insert a row with layout when value is true

I have a code that does a loop through a worksheets, if there is a value 2 inside a cell in column S, then I want to insert a row with a specific layout. I have the code, but it takes ages to complete....
5
votes
0answers
61 views

Chart Based Animations In Excel VBA

I've been working on re-writing comfortablydrei's answer to this PPCG Question regarding creating a illusion animation in pure Excel VBA. So far, I've been able to rewrite the code to function in VBA, ...
0
votes
0answers
62 views

OOP approach to filter two-dimensional array

So, after this functional(?) approach and thanks to the great improvement of @CDP1802, I've decided to try an OOP approach to filtering an two-dimensional array. In my opinion, the result is way more ...
1
vote
0answers
26 views

Assign random shift with restrictions

Based on this question Thought it was a nice puzzle Main idea: How to randomly assign shifts to employees based on these restrictions: As per the O.P.: Randomly write to cells "1" or "0" ...
4
votes
1answer
79 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 ...
-1
votes
1answer
48 views

Worksheet change and worksheet selection change slowing down my file

I have a file that i use as database. It has the records and in the row 1 several cells used as buttons, (open folder, copy text, send mail, ecc.) At any change on any column of any record the file ...
1
vote
1answer
42 views

VBA: Calling one sub repeatedly and scope of variables

My code as a whole works for me without issues, but what I want to improve is a small part right out of the middle of it. I hope it's ok to post a simplified snippet here that just shows the structure ...
2
votes
1answer
55 views

Performance on countifs and sumifs

I'm trying to calculate with SUMIFS and COUNTIFS some data. The output sheet looks like this: I've hidden some irrelevant or ...
2
votes
1answer
68 views

aggregate sheets from many excel workbooks into one workbook

I want to put the worksheets from several (2-5) excel workbooks (files) into one single workbook. The names of the workbooks are not standardized and so I opted for a dialog box to select the ...
0
votes
0answers
17 views

Outlook - put all ungrouped contacts in a separate folder

I have linked my icloud contacts to outlook, and wanted to display all contacts which had not been grouped. I wrote this sub for that: ...
8
votes
1answer
137 views

Data entry of Information

Couple of items to make note of first: Some of the code is inherited the other has been refactored by me. The procedures that have an underscore in them I am still working on refactoring. I ...
2
votes
1answer
63 views

Best practice when checking multiple addresses for a Worksheet_Change() event?

I'm doing some code revision and I'm looking at this portion of my Worksheet_Change() event: ...
8
votes
1answer
232 views

Validate an IBAN

I've found an explanation on Wikipedia on how to validate an IBAN. Since the number generated from the transformation can cause overflow with all data types available in VBA, I've worked with ...
6
votes
1answer
71 views

Survey Populate with List, Option Label and Formula, VBA

I am quite a novice. The below code does what I require but I was hoping you could help me speeding it up and simplifying it please. I know should start with basics when learning VBA..but it's just so ...
2
votes
1answer
104 views

VBA Automatic insert in a Excel Spreadsheet

Since I'm new at this site I will try to start with something very simple. I'm making an "Automatic insert" in a Excel Spreadsheet and my code is working correctly, but I'm not so sure about my way ...
3
votes
4answers
343 views

Find duplicated text for tasks in MS Project

My code in MS project VBA, in theory, doesn't do anything major. It compares the tasks with each other, but it runs super slow. One run through Temp lasts 15 secs. ...
4
votes
2answers
97 views

VBA to retrieve/display information of cells in excel

I am working as a validation technician for excel spreadsheets in a pharma company. Sadly & interestingly I don't know much about VBA and Excel. To validate those excel spreadsheet, I developped ...
1
vote
1answer
35 views

Calculating a Score in VBA based on selected ShapeStyle. Is there a better/shorter way to do this?

I'm calculating a score based on whether or not certain colors shape is selected. Some of the shapes are in groups, some are not. For the shapes which are in groups, only one of them will count ...
2
votes
0answers
48 views

Better ways to edit Excel through MS Access?

I have an Access macro that runs AfterUpdate of a form. It opens an excel workbook and edits a few cells. I have It working the way I want, but the problem is that ...
1
vote
2answers
74 views

Autofiltering and deleting rows two times too slow

...
1
vote
0answers
66 views

Managing Excel Tables (ListObjects) with OOP Approach (Second follow up)

This is a follow up to this question and this question Objective: Manage what happens when users interact with Excel Tables (ListObjects) Code incorporates: ...
5
votes
1answer
152 views

Class to organise frames on an Excel userform

The Task A task I've been given recently is to design a data entry form which transfers data from the form to a table on a worksheet. Depending on the answers given to various questions, other ...
5
votes
1answer
244 views

Evaluating formulas greater than 255 characters

Recently I was receiving Error 2015 when trying to use Application.Evaluate, then I realized it was because my formula was greater than 255 characters. As a ...
2
votes
1answer
117 views

Adds text to specific cells then bolds one column and copies it to target sheet removing bolded column. Makes last column red

What I have tried to accomplish with the code is to make some sort of partner budget where 2 people can have 2 separate budgets with separate expenses but which are still intertwined with eachother in ...
3
votes
1answer
63 views

Checks data already stored in specific worksheets then populates data as needed

The code below looks at different range values and then populates specific cells on a worksheet called GeneralInfo in the Worksheet_Activate event.The below code ...
0
votes
1answer
73 views

Trying to optimize VBA code to create worksheets

I am learning to clean my code and make it more efficient, however I'm having trouble with my code, because most of the post about the subject are specified to a given code. The code below looks like ...
1
vote
0answers
32 views

What is the fastest way to determine if a table spans two pages?

The initial problem that led me to learn VBA is as follows: You have a table that can be up to 10,000 rows (several hundred pages) long in a Word document. The table has a title in the form of a ...
3
votes
1answer
83 views

SQL to Excel then to CSV file for Data Upload

Before we get started I need to let you know a critical piece of information: Due to permissions within an offsite database I am NOT allowed to create tables even temporary ones within the database ...
3
votes
2answers
66 views

Retrieve status for a list of FedEx tracking numbers

Background If you buy something from our facility, you will get a box with a shipping label on it. The two main numbers it will have are a FedEx tracking number and a carton number. For cartons that ...
2
votes
1answer
88 views

How to speed up VBA to Extract data from Word to Excel

I am new to stackoverflow and a newbie to VBA coding. At my work, we are supplied with shipment data in the form of Ms Word which is not very useful. I have found a way to transfer the data using VBA ...
3
votes
1answer
103 views

Implementing a class hierarchy and instancing the base class in VBA

Objective: Have a single point of entrance to initialize a class that holds instances of "sub" classes Background: I read about inheritance in VBA (or as close ...
1
vote
1answer
49 views

VBA Class instance to simulate a framework

Objective: Simulate namespaces in VBA and access functions like if you had a Framework setup or at least that was what I ...
2
votes
1answer
103 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 <...
2
votes
2answers
88 views

Why does it take so long to print values from userform to sheet?

I have a userform with around 20 controls in that can be inputted. Some are textboxes some are comboboxes etc. The user fills in these controls and then hits save. When save is pressed, the code ...
2
votes
1answer
36 views

Copy Certain Cells over to another worksheet based on column headers

I have two worksheets in my workbook. The first worksheet ("home"), the user will enter information in cells B7-B14, not all of the fields are required in order for the macro to proceed. I need each ...
4
votes
1answer
158 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 ...
4
votes
4answers
113 views

Check non-continuous range for equal values

Background I'm trying to check equality between cells in an irregular, non-continuous range of cells. For this purpose I would like to know if all cells are equal to the first ...
2
votes
2answers
78 views

Excel VBE code find and replace

I need to write a VBA code routine with an efficient way to replace blank cells with values from another cell. For example, my worksheet has some blank cells on random rows in column D. I want to ...
1
vote
1answer
79 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 ...
1
vote
1answer
43 views

Populate dates in a label based on dates in a hidden sheet using IIF

The code below uses information saved in a hidden worksheet based on values from another sheet with a codename of GeneralInfo and is called when specific cells in GeneralInfo are changed. I think ...
0
votes
0answers
55 views

When passing in a range in an excel worksheet in VBA code makes the code run through every cell causing the code to run slow?

When passing in a range in an excel worksheet in VBA code makes the code run through every cell causing the code to run slow. I want to be able to pass in the range RngOP into the method ChangeCode(...
2
votes
1answer
46 views

Opening a specific Outlook item quickly

I have this code to open an outlook appointment item: ...
2
votes
1answer
48 views

Loop with multiple conditions that need to be true, across two different sheets

I've written some code in Excel VBA that does the following: Finds a cell ("O") in a range (C3 to Z26) Looks at an adjacent cell. This cell is located through "OFFSET_ROW" and "OFFSET_COLUMN" (...
8
votes
4answers
175 views

Saving worksheets as pdf and sending per mail

As the year comes to an end our company need new time-sheets for the new year. Because this is my task to do, I thought I would do my collegues something good by automating some tasks they would ...

1
2 3 4 5
23