Concatenating a table column into a single string
This is a pretty cute bit of SQL that I was shown the other day. I needed to list the unique values in a table as part of a pivot query. This does the job nicely. Much better than looping through a...
View ArticleClearing a worksheet below a given range
A common task is to clear the data from a table made in an Excel spreadsheet without clearing the headers or the inputs stored above the table. This is easily done using the following code Sub...
View ArticleGranting permissions to all items in a schema
This post is mostly for my own benefit as I keep on forgetting the syntax! It’s easy enough to write a script that will grant permissions to all items (e.g. tables) by looping through them, but if...
View ArticleSimplifying Databases and Recordsets in VBA
It is reasonably easy to connect to a database in VBA, but pulling out some data into an array is slightly involved. Create connection Create command (or sql) Open connection and attach to command...
View ArticleManaging Workbook Versions in Excel
If you’re using Excel in a business environment you’ll often have a workbook which for the end-users is Read-Only. Generally there will be a requirement that the users fetch it from a particular...
View ArticleImproved SQL Table and View permissions
When developing a database application, you will often need to set up permissions for lots of users on lots of tables, which is really easy because it is pretty much just Copy-Paste once you’ve done...
View ArticleCalculating first/last Monday of the month – Part 2
A while ago I posted some useful VBA functions to calculate the first/last Monday of the month, but in the spirit of trying to move towards doing everything with Excel DNA rather than VBA, I decided to...
View ArticleLinear Programming and Shortest Path problems in C#
I have a real interest in Linear Programming (LP) and other problem solving methodologies such as Genetic Algorithms. If you need an open-source solver you can use GLPK, and if you want a C# wrapper...
View ArticleLinear Programming Network Flow problem in C#
I’ve just updated my LP library mentioned in my previous post. I’ve now removed the ShortestPath problem class and created a new NetworkSolver library which has ShortestPath and NetworkFlow classes....
View ArticleEasy Custom Menus in Excel
I didn’t invent the following technique; like everyone everywhere, I built on something I found online. Note: this will work in 2007 or higher, but of course it isn’t using the Ribbon so new menus will...
View Article