Visual Basic for Applications (VBA) is an event-driven programming language which was 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. If your question is ...
4
votes
3answers
114 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 ...
0
votes
0answers
21 views
Passing an error object back to calling code [on hold]
I'm still on a quest to understand error handling more.
Here's some code sent to me by fmsinc.com. I like it a lot, so why have I not see this sort of thing before. I'm wondering whether I should ...
5
votes
3answers
110 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
74 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
162 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
209 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
70 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
1answer
118 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
71 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
160 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
74 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
63 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
59 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
39 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
169 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
134 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
78 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
115 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
0answers
110 views
Can this Excel VBA with ADODB connection to Access database be improved in performance?
I have an issue: speed in Excel retrieving data from Access external database (47 sec. --> I want to reach 3 seconds) Excel 2010 Access 2000.
Suggestions:
Add Library reference for Microsoft ...
4
votes
2answers
179 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
46 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
83 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
285 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 ...
2
votes
1answer
50 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
378 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
48 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
56 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
59 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
178 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
176 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
124 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
248 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
50 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
65 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
48 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
196 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
63 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
62 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
176 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 ...
4
votes
2answers
116 views
Extracting and analyzing data from SAP
I developed a script for the company I work for in order to extract data from SAP (CJ74) and analyze the data.
One particular issue I am finding is that for any data sets which have over 1000 lines, ...
6
votes
3answers
240 views
Remove blank entries from row
I wrote a sub to remove the blank entries in a row without shifting the cells around but it seems unnecessarily clunky and I'd like to get some advice on how to improve it.
...
6
votes
2answers
123 views
Copy data to another worksheet
I have the following but it takes long time to run, it is a simple wherein the user select a file and data from Sheet1 is copied to another workbook.
...
5
votes
4answers
168 views
Find function for strings in cells
In column A, I have many strings ~ 32000 cells each containing unique string values. I then have columns C to as many as 30/40 columns which all contain approximately 400 rows of text.
Check column ...
4
votes
2answers
84 views
Text files: Copy, Rename, Append/Merge together
I wrote 3 subroutines related to batch data processing, they will be used together. A bit of background, I wrote this for my admin colleagues who do not write code. An application dumps daily ...
5
votes
1answer
48 views
Update on Weave Merging n lists into single list
This is a follow up to my previous post from 7 months ago. I changed up the algorithm a little. Instead of inserting items into a new list, each item's final place is calculated up front. Sort of like ...
8
votes
1answer
84 views
Growing my own Tree (Structure)
Summary
VB6 doesn't have a great selection of data structures to work with, so again I find myself creating my own. I have a need to dynamically generate a directory structure on the file system. The ...
4
votes
2answers
134 views
Counting and Deleting Duplicate Data
Can anyone help me optimize the current VBA code below? It is taking 20 seconds currently to collect,store, check and validate 1000 data's.
This program takes specific values from multiple sheets and ...
11
votes
2answers
99 views
Follow-up: Randomizing Civilization 5 team choice
This is a follow-up on my previous question about a VBA macro for randomizing a draw from a table. It can be found here:
Randomizing Civilization 5 team choice
The code has been improved with the ...
16
votes
2answers
290 views
Randomizing Civilization 5 team choice
This macro is made to randomly draw specific number of civilization choices for a specific number of Civ V players. It is based on a list of 43 possibilities and the ...