Alright, I ran short of time this week, so I don’t have a tutorial. But I DO have another fun UDF (User-Defined Function)–this one takes two parameters. Both need to be strings made of comma separated numbers. The function excludes the second set of numbers from the output.
VBA: How to Get A List From a Range of Numbers
A couple months ago, I did the exact opposite of this. I called it the ListToRange() Function. It’s weirdly helpful at work because I have to go back and forth between having numbers listed out and then having them clustered for other things.
Continue reading “VBA: How to Get A List From a Range of Numbers”
VBA: How to get a Range of Numbers from a List
So I’ve finally reached that point where I’m writing Macros well enough to accomplish simple tasks, but the results are just not pretty to look at. One of my macros returns a list of numbers associated with some data in a worksheet that looks like this:
, 1, 2, 3, 4, 5, 7, 10, 11, 12, 34, 35, 36, 37
Kind of gross, right? I want a to have a concise list. And DEAR GOD, you’d think writing the logic to get 1-5, 7, 10-12, 34-37 would be breeze.
Continue reading “VBA: How to get a Range of Numbers from a List”
VBA: How to Write Your Own Function
So last week, I learned that VBA buttons are supremely helpful. For moving data between workbooks or breaking down information from a KML file, these are ideal. Especially the KML file importer because it’s basically populating a full on spreadsheet.
But if you want to have a function run very specific math or customized scraping on a string that’s only going to affect one cell, go with the UDF. Sounds like a terrible disease, doesn’t it? In Excel, it stands for User Defined Function.