Thursday, September 9

Blogging as VBA therapy.

Aaaaaargh!

Busily programming macros in MS VBA for Excel. Well, I say "busily programming". What I am of course actually doing is busily getting pissed off while not programming at all because the bloody language won't let me program in it.

I don't subscribe to any of that "Microsoft are evil" shite because of their business practices. I am, however, perfectly open to the idea that some of their bastard programmers are evil as all hell, for the following reason.

In Excel, start recording a macro. Do some stuff. Stop recording the macro. Put the file back exactly as it was when you started. Make no changes to the macro. Try to run the macro. Usually, it works, doing what you did when it was recording. Usually. Why not always? Why have Microsoft's evil Excel programmers set the application up to automatically record code that doesn't fucking work? Bastards.

And another thing.

Sheets("data").Select
Range(Cells(1, 1), Cells(10, 20)).Select


is supposedly just a slightly longer way of writing

Sheets("data").Range(Cells(1, 1), Cells(10, 20)).Select


Officially, those two bits of code have exactly the same effect. And, most of the time, they do. Just most of the time. Now and then, the second one throws up errors. And it's a total bugger trying to figure out where the errors are coming from, because the last bit of code you try to debug is the bit that you know for a fact must be OK because you used it in exactly the same way a few lines earlier and it bloody worked then.

That's better.

No comments: