您好,欢迎来到中国最大的生活服务网站![登录][注册]
版主:Mniwtian   副版主:
点击查看所有副版主

sheet or a UserForm.

The Visual Basic Editor (VBE) Edit toolbar contains two very useful buttons. Select a group of instructions and then click the Comment Block button to convert the instructions to comments. The Uncomment Block button converts a group of comments back to instructions. These buttons are very useful, so you might want to copy them to your Standard toolbar.

 

 

Sub Procedure2()

''   - [Code goes here] -

End Sub

 

Normally, the value of a module-wide variable does not change when a procedure ends normally (that is, when it reaches the End Sub or End Function statement). An exception is if the procedure is halted with an End statement. When VBA encounters an End statement, all module-wide variables lose their values.

 

PUBLIC VARIABLES

To make a variable available to all the procedures in all the VBA modules in a project, declare the variable at the module level (before the first procedure declaration) by using the Public keyword rather than Dim. Here''s an example:

 

Public CurrentRate as Long

 

The Public keyword makes the CurrentRate variable available to any procedure in the VBA project, even those in other modules within the project. You must insert this statement before the first procedure in a module (any module). This type of declaration must appear in a standard VBA module, not in a code module for a

 

STATIC VARIABLES

Static variables are a special case. They are 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.

用户名: 请您登录后再发帖 
标 题: 标题请勿超过30个字
内 容:
 
  请阅读我们的[服务条款]
Copyright © 2009 Yahoo.com.cn 版权所有 不得转载 | 使用须知 | 著作权声明 | 京ICP证000022号 | 国家药监局(京)-经营性-2004-0039
全球阿里巴巴 - 阿里巴巴网络:中国站 国际站 日文站 | 淘宝站 | 支付宝 | 中国雅虎 | 口碑网 | 阿里软件 | 阿里妈妈