01-07 Properties

VBA Properties: refers to the object that has the characteristics?

Human attributes: name, age, ID number, address ....

Sub 属性()
Application.SendKeys "^g ^a {del}", True  '清空立即窗口的内容'
Debug.Print Sheet1.Name  '得到工作表1的名字'
Debug.Print sheet1.CodeName  '得到工作表1的名称,也就是codeName'
Debug.Print Sheet1.Range("a1").Value  '得到sheet1表中a1单元格的值'
End Sub

Note : View in the Immediate window, shortcut keys Ctrl + G , CodeName is a read-only property;

Debug.Print : Debug.Print statement is mainly used for displaying information in the Immediate window. If developers want to monitor the value of many variables in the program is running, each time using MsgBox pop-up dialog is very inconvenient, then you can use this statement the output displayed in the Immediate window, run the process to be completed before the line view.


Note : If Sheet3 (sheet333): sheet3 is codeName, and parentheses sheet333 is the name of name, but also the worksheet.

Assignment VBA object properties

Sub 属性赋值()
Sheet2.Name = "改变自己"  '修改sheet2的表名'
Sheet2.Range("a1") = "学习VBA了"  '修改sheet2表中的a1单元格的值'
End Sub

Exercise:

1. how to call the Immediate window in the program?
What shortcut keys 2. Immediate window is? What is the role of the Immediate window?
The display name attribute and codeName properties window immediately in sheet1

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

Accessories list

 

Guess you like

Origin www.cnblogs.com/bwtx/p/12115467.html