Excel VBA Topic 4.1.2 - Example, Reusing a Sub Procedure

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

when I dim the variables to be integers and then change them into double type numbers, ex. I let a = 3.14, the script still compile and run correctly. But it is not indeed correct, it just forced a = 3. How can we avoid this potential bug in the future? Do we always dim numerical variable to be double to solve them all?

Amethystxx
Автор

m & n are NOT declared as Double. They are declared by default as... Variant.

That means we could type

Call Addy("Jaimie", "Cersei") which would result as an execution error but would still compile correctly.

LughSCI
Автор

here again i got to dim it as integer then only it works

deepakshrestha