All Questions
29
questions
12
votes
2
answers
25k
views
String Repeat function in VBA
VBA has built-in functions for repeating a single character:
Function String$(Number As Long, Character) As String
...
12
votes
4
answers
2k
views
Delete rows in spreadsheet where cells match some patterns
I have vba code that loops through a large number of records and deletes rows based on criteria. The issue at hand is that it takes far too long to run. I have never actually let it finish because it ...
7
votes
1
answer
230
views
A Moses's worthy string splitter
I am trying to perfect my string splitter's performance, to be more fast, more easy to maintain if someone else reads it and more readable code-wise.
Context ,Scope and Objectives
Where I work we ...
7
votes
4
answers
15k
views
Hex encoding and decoding of ASCII strings in VBA
I needed to convert some Ascii text to binary in Hex format 0x00FF....
I've written an EncodeHex and a ...
2
votes
1
answer
688
views
Trimming whitespace in Excel cells
I often receive large Excel-sheets in which data has been inserted via copy and paste. Usually a lot of the cells contain whitespaces at the beginning and the end before / after the actual value.
I ...
4
votes
1
answer
2k
views
Hex to Double converter
I stumbled on this SO question which was asking about a way to convert larger hex values to a positive numeric value:
...
6
votes
2
answers
1k
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 ...
5
votes
2
answers
1k
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 ...
8
votes
1
answer
11k
views
Representing Objects as strings in VBA
I am working an a more meaningful way to print objects in VBA. The desired result should look something like this.
...
43
votes
4
answers
14k
views
A lightning-fast StringBuilder
In the process of trying to build a serializable data structure, I found myself building large strings, which gets very slow because VBA copies a string every time concatenation is performed.
To ...
9
votes
3
answers
1k
views
Ugly workaround to get the vbext_ProcKind of a procedure is breaking encapsulation
This is a follow up to Extending the VBAExtensibility Library. It turns out that code had a really nasty bug. Anytime vbeProcedure.StartLine got called, I was ...
4
votes
2
answers
842
views
Extract a character at particular place in a string
I have a function:
...
20
votes
3
answers
3k
views
A CSharpish String.Format formatting helper
A while ago I implemented .net's string.Format() method in VB6; it works amazingly well, but I'm sure there has to be a way to make it more efficient.
I'll start ...
10
votes
3
answers
977
views
A more readable InStr: StringContains
Consider the following:
If myString = "abc" Or myString = "def" [...] Or myString = "xyz" Then
In C# when myString == "abc" ...