Accessing worksheets in Excel using a macro |
||
| Worksheets can be accessed using index numbers
in a macro An index number is a sequential number assigned to an Excel sheet, based on the position of its sheet tab (counting from the left) among the Excel sheets of the same type. The following procedure uses the Worksheets property to activate worksheet two in the active Excel workbook. Sub selectsheet2() Worksheets(2).Activate End Sub If you want to work with all types of sheets in Microsoft Excel(worksheets, charts, modules, and dialog sheets), use the Sheets property. The following procedure activates Excel sheet three in the workbook as also demonstrated in the Excel training video. Sub selectsheet3() Sheets(3).Activate End Sub Implementing the process:
Note: The index order can change if you move, add, or delete the Excel sheets. |
||
|
||
|
|
||
|
|
||
|
|
||