Читать книгу Excel 2019 Power Programming with VBA - Michael Alexander, Dick Kusleika - Страница 156

Static variables

Оглавление

Static variables are a special case. They're declared at the procedure level, and they retain their value when the procedure ends normally. However, if the procedure is halted by an End statement, static variables do lose their values. Note that an End statement is not the same as an End Sub statement.

You declare static variables by using the Static keyword.

Sub MySub() Static Counter as Long '- [Code goes here] - End Sub

Excel 2019 Power Programming with VBA

Подняться наверх