Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mysterytramp

macrumors 65816
Original poster
Jul 17, 2008
1,334
4
Maryland
This morning I had to process about 5,000 lines of data from a web site into an Excel table (2007 for Win XP). Transmission glitches added two or three cells to a couple of hundred rows. I needed to append one cell to the cell to the left and then move a cell over. A word processor might have done the task but brute force seemed the least pleasant option. It seemed like a simple matter of recording a macro.

At work, I use Excel with the full Ballmer-blessed Office experience. In this environment, I mistakenly believed Excel would record a "copy" and a "paste." Instead, it hard-code the original values into the macro. Hit the keystroke and the cursor moves around and plunks that data into a new cell. Worthless.

Also worthless was F1, and don't even ask about our IT department. Cussing, I googled and found several web sites with author's showing off their VBA prowess with complex data manipulation. (M$, BTW, kept pointing me to broken links. Go figure.) Finally I found something that almost fit my purposes. After about a half hour, I had a working macro.

1) I bet the exercise would have gone a lot faster if VBA were more procedural than object-oriented. Maybe for a giant project, an object-oriented macro language makes sense. But for crying out loud, it's a MACRO. Nobody is going to land the damn space shuttle with VBA!

2) That is one crappy editor for VBA. I don't understand how Microsoft jockeys aren't going blind; the company's interfaces are based on pixel sized icons.

3) I completed the work with greater appreciation for Apple's lowly scripting language. Granted, I know Applescript better, but I bet if I had a spreadsheet with a decent AS dictionary (Mariner Calc perhaps?), I could have completed the job in 10 minutes, with a script I could use again. This VBA mess I wrote will never again see the light of day.

Excuse the rant ...

mt
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Unix commandline tools, FTW!

Pull stuff from a website/URL:
curl or wget

Parse it:
quick perl script
awk
sed
others, i'm sure

Correct a few glitches:
More awk, sed, and so on
vi (but essentially using sed commands)

It may be too late now, but i'm sure plenty of folk here will help you out in stringing the stuff together in the future if needed.

-Lee
 

mysterytramp

macrumors 65816
Original poster
Jul 17, 2008
1,334
4
Maryland
I thought about posting here but the project had to be done stat. Plus IT has a pretty big clamp on what we're allowed to add to our computers, so if it didn't come with a standard Windows/Office installation, it couldn't be used.
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
lee120 is right

sometimes (ok, always) the UNIX command-line is just better for these sorts of things.

Would the IT control-freaks object to installing cygwin (assuming they even know what it is) ?. Even cygwin's poor cousin, Windows PowerShell, would be helpful (and it may already be installed).
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
lee120 is right

sometimes (ok, always) the UNIX command-line is just better for these sorts of things.

Would the IT control-freaks object to installing cygwin (assuming they even know what it is) ?. Even cygwin's poor cousin, Windows PowerShell, would be helpful (and it may already be installed).

cygwin is essential when one must use windows. I am using a windows machine now, but the vast majority of my screen is covered with xterms ssh'd to linux servers, by means of a rootless x-server running in cygwin. I keep a few local xterms open to run some local scripts, parse things locally, etc.

mysterytramp: Are your IT folk paranoid enough to prevent you from installing any local software? Or are they simply unwilling to support things they haven't installed? If the latter, you should be able to do a cygwin install yourself and have a real shell available in a few hours.

-Lee
 

mysterytramp

macrumors 65816
Original poster
Jul 17, 2008
1,334
4
Maryland
Would the IT control-freaks object to installing cygwin (assuming they even know what it is) ?

Yes. We're under pretty strict orders that NOTHING can be installed without their approval. They're not bad, but they aren't app folks. They're network people. If a user wants to add something, it might make more work for them, so better to deny it.

mt
 

mysterytramp

macrumors 65816
Original poster
Jul 17, 2008
1,334
4
Maryland
Excel can also read tabular data directly from a web site.

I realize my original post was a little long, but basically that's what I was doing. But because of a glitch either in the Web site or in Excel, in about 100 or so rows, 8 columns became 9 and 10.

mt
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.