VBA中简单实用的语句(国外英文资料).doc
文本预览下载声明
VBA中简单实用的语句(国外英文资料)
Common statements
(1). Workbook
1. On the Error Resume Next ignore the Error to continue VBA code, avoid the Error message
On Error GoTo ErrorHandler jump to somewhere in the process when the Error occurs
Application. DisplayAlerts = False will not be displayed during the execution of the program
Application. Screenupdate = False closes the screen refresh
Application. Screenupdate = True opens the screen refresh
The activeworkbook.name returns the name of the activity job
6 ActiveWorkbook. WindowState = xlMaximized maximizes the current workbook
(Sheet1).name = Sum
The Worksheets ( sheet1 , sheet2)).select also Select Worksheets 1 and Worksheets 2
ActiveSheet.usedrange. Delete deletes all conditional formats in the current worksheet
10 activesheetsetup. Orientation = xlLandscape or activesheetsetup.orientation = 2 change the page Settings to landscape
Cells. Select selects all Cells in the current worksheet
Range ( A1 ).clearcontents clears the contents of cell A1 in the activity table
Selection. ClearContents clears the selected area content
The Range ( A1: D4 ).clear completely removes the contents of the A1 to D4 cell area, including the format
13. ActiveCell. Offset (1, 0). Select active cell down a line, in the same way, can move down a column
The Range ( A1 ).offset (ColumnOffset: = 1) or Range ( A1 ).offset (1) Offset column
The Range ( A1 ).offset ( A1 ) or Range ( A1 ).offset (-1)
14. ActiveWindow. RangeSelection. Value = XX XX will Value input to the selected cell area
15. ActiveWindow. RangeSelection. Count active window, select the cell number
Range ( A1 ).interior. ColorIndex, or Cells (1, 1). Interior. ColorIndex gets the element A1 background color
The Name of the array ArrayNum is called MyArray
The Name of the ProduceNum : = $B $1, Visible: = False hides the Name
Cells (8, 8). The formula aarray = SUM (R2C [-1] : R [-1] C [-1] C]) enter the array formula in the cell. Note that you must use an expression in the R1C1 style
(2). Th
显示全部