文档详情

VBA入门的基础语句-详解(国外英文资料).doc

发布:2017-06-06约9.87千字共17页下载文档
文本预览下载声明
VBA入门的基础语句-详解(国外英文资料) The basic statement of the VBA entry - detailed solution Select a worksheet: ( Balance ). Activate. Select cells: Range ( A1 ). The Select Select a contiguous cell: Range ( A1: G8 ). Select Select a discontinuous cell: Range ( A1, B6, D9 ).select Range ( A1, B6: B10, D9 ).select Select the working book for the current activity: ThisWorkbook. Activate If you choose another workbook, note that the workbook must be open, and dont forget to add the suffix .xls for example: Windows ( Totol. XLS ) Select a worksheet: ( Balance ). Activate. Cell move: ActiveCell. Offset (13, 14). Select Offset (-3, -4). Select Range ( G8 ). Offset (-3, -4). Select Note: you can define a variable and implement it with an offset, for example: VarFreightRowsCount = Range ( A1 ).currentregion. Rows. Count (varFreightRowsCount, 0).select Select the entire worksheet: Cells. The Select Select the area where the current cell is located (in the case of a null row/empty column) : Range ( A1 ).currentregion. Select content comes from the vba technical federation Select rows or columns: Rows ( 1 ). The Select The Columns ( A ). The Select Or: ActiveCell. EntireRow. Select ActiveCell. EntireColumn. Select Select contiguous rows/columns: Columns ( A: C ). Select Rows ( 1:5 ).select Choose not contiguous rows/columns: Note: use Range instead of Columns/Rows instead of Columns/Rows : you are using Range instead of Columns/Rows. The Range ( A: A, C: C, E: F ).select Range ( 1:1, 5:6, 9:9 ).select Select the current active cell to the last non-empty cell: The Range ( A1 , Range ( A1 ).end (xlDown)) Range (ActiveCell, ActiveCell.end (xlDown)).select Select the current active cell to the first non-empty cell: Range ( A32 , Range ( A32 ).end (xlUp).select Range (ActiveCell, ActiveCell.end (xlUp)).select Select the current active cell to the right to the first non-empty cell. Note: xlTORight instead of xlRight The Range ( A1 , Range ( A1 ).end (xltoRight).select Range (ActiveCell, ActiveCe
显示全部
相似文档