"When I was tasked to do a few quick changes to the CMCalc 'application', I knew I'd be in for a treat," writes Will, "it's been the bane of all developers on the team: a spreadsheet designed by an end-user who knew too much that was coded by a developer who thought he knew a lot, and maintained over a decade by developers who mostly knew nothing."
"Being that it was VBA, I didn't expect much... yet somehow, I was blown away. It was here that I learned that yes, VBA supports GoTo statements. And line numbers, too. And for whatever reason, those are preferred to a simple If-Else block."
Sub dwb_eng() ActiveSheet.Unprotect Let i = Range("a!Q7").Value If i = 1 Then GoTo 100 Else GoTo 200 100 ActiveSheet.Shapes("Option Button 22").Visible = True GoTo 300 200 ActiveSheet.Shapes("Option Button 22").Visible = False 300 ActiveSheet.Protect End Sub
"Obviously," Will added, "the rest of the code is similarly wrong... so, so wrong."