1.1 Common objects and meanings
| Object Name |
Meaning |
| Application |
The entire Excel application |
| Window |
Window |
| Worksheet |
a worksheet |
| Sheets |
To specify a collection of all worksheets for a workbook |
| ShapeRange |
Shape Area |
| PivotTable |
Pivot table |
| Workbook |
Workbooks |
| Shape |
Objects in the drawing layer |
| Range |
A cell, row, column, selected range |
| Name |
Definition name of the cell range |
| Chart |
Chart |
| FileDialog |
File dialog box |
| CommandBarPopup |
A pop-up control on the command bar |
| CommandBar |
a command bar |
1.2 Worksheets methods at a glance
| Name |
Description |
| Add |
new worksheet |
| Copy |
Copy a worksheet to another location in the workbook |
| Delete |
Delete Object |
| Fileacrosssheets |
Copy a range of cells to all other worksheets in the collection in the same location |
| Move |
Move a worksheet to another location in the workbook |
| PrintOut |
Print objects |
| PrintPreview |
Print Preview |
| Select |
Select Object |
1.3 Event Categories
| Object |
Event |
| Application |
Application Events |
| Workbook |
Workbook events |
| Worksheet |
Worksheet events |
| Chart |
Chart events |
| UserForm |
Form Events |
| Label |
Label events (controls in the form) |
| Image |
Image events |
1.4 Character processing function
| Key words |
Role |
| StrComp |
String similarity judgment |
| StrConv |
String type conversions |
| LCase UCase |
Uppercase and lowercase transformations |
| Space string |
Repeating string |
| Len |
Calculating string Lengths |
| Format |
Set character formatting |
| LSet RSet |
Rearrange strings |
| InStr left LTrim mid right RTrim trim like |
Working with strings |
| Split Jion |
Splitting and connecting strings |
Instance
Sub StrComp operation ()
MsgBox StrComp ("ABCD", "ABCD", 1) ' parameter 1 in text comparison, case-insensitive, return 0, representing equality
MsgBox StrComp ("ABCD", "ABCD", 0) ' parameter 0, in binary comparison, returns-1, indicating that the former is less than the latter
End Sub
Sub StrConv operation ()
MsgBox StrConv ("中文版", vbuppercase) ' turn into uppercase
&CHR & StrConv ("中文版", vblowercase) ' turn into lowercase
&CHR & StrConv ("中文版", vbProperCase) ' only start with uppercase
End Sub
Sub Case conversion ()
MsgBox LCase ("HELLO")
MsgBox UCase ("Hello")
End Sub
Sub repeats n times ()
MsgBox String (5, "*") ' return ' * * * * * * *
MsgBox String (4, "China") ' return ' in middle medium "only repeat left one
End Sub
Private Sub Textbox1_change ()
If Len (TextBox1.Text) >0 Then
If right (textbox1.text,1) like "[A-z]" then Exit Sub Else Me.textbox1=left (Textbox1.text,len (TextBox1.Text)-1) ' Like Use, find help documents specifically
End If
End Sub
1.VBA Basic concept-self-study of Excel VBA program development