GoTo in VBA

后端 未结 5 2116
情书的邮戳
情书的邮戳 2021-02-16 00:10

From the VBA help file:

GoTo Statement

Branches unconditionally to a specified line within a procedure.

Syntax<

5条回答
  •  余生分开走
    2021-02-16 00:44

    I read many comments about GOTO being poor programming..

    Back in the olden days when a Hewlit Packard 25 had 25 memories to store all instructions and variables BASIC was still Beginners All purpose Symbolic Instruction Code and much better than doing things in 6502 Assembler I went to computer conference where the one of the experts was takling about a new language that used blocks and None of GOTO GOSUB AND RETURN .. yea PASCAL At the time I KNEW it was impossible to have such a language but since have spent about 20 years teaching and designing commercial software in PASCAL With MS backing their Office with VBA of course Pascal has become rare even though Delphi was still used as a early years teaching language.

    To cut IT short
    If you consider the machine code constructed for IF then else end if and the fact that VBA still evaluates ALL of AND OR NOT XOR in an If ....... Then when you need to evaluate one a few million times the then GOTO can save you a few seconds.

    However on the topic of ON Error Resume Next many use these to test if a workbook is open or a Sheets exists on a closed workbook... ...etc etc .. In some cases that is poor programming in that the program has to check all before showing an error whereas for each .... while Not Found found = a = b wend only has to check until found

    My first teaching computer was a PDP 8 ... 8Kb .. Punched tape teletype for printing and I/O .. 7 Octal switches to boot. Then moved up to Comodore 64 .. Current 16 GB computer has memory of 250,000 of them.

    a topical comment with the FBI CIA etc .....Homeland Security Trumps them all.

提交回复
热议问题