Skip to main content

All Questions

Tagged with
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 ...
ThunderFrame's user avatar
  • 1,959
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 ...
PartyHatPanda's user avatar
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 ...
svacx's user avatar
  • 433
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 ...
ThunderFrame's user avatar
  • 1,959
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 ...
michael.zech's user avatar
  • 4,358
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: ...
Mathieu Guindon's user avatar
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 ...
CBRF23's user avatar
  • 409
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 ...
Phrancis's user avatar
  • 20.4k
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. ...
cheezsteak's user avatar
  • 2,401
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 ...
Blackhawk's user avatar
  • 1,134
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 ...
RubberDuck's user avatar
  • 30.8k
4 votes
2 answers
842 views

Extract a character at particular place in a string

I have a function: ...
Sujith Karivelil's user avatar
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 ...
Mathieu Guindon's user avatar
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" ...
Mathieu Guindon's user avatar

15 30 50 per page
1
2