Activate / Select
Understanding the difference between Selecting and Activating
There is very little difference between activating a worksheet and selecting a worksheet.
The following means that worksheets "Sheet 1", "Sheet 2" and "Sheet 3" are all selected
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
When more than one worksheet is selected the first worksheet is always the active worksheet.
Activating sheets is a slow process.
You can only ever activate a single worksheet.
Sheets("Sheet2").Activate
Cannot activate different worksheets when several are selected
The first line will select three worksheets and by default the first worksheet will be the active worksheet.
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
The second line will not keep the current selection but will infact just select the "Sheet2" worksheet.
Sheets("Sheet2").Activate
This is different functionality to the Select and Activate when using a Range object.
ActiveSheet.Previous.Select ??
Selecting Sheets
Redim Preserve arNames(1 to 5)
Sheets(arNames).Select
Worksheets(2)
Worksheet Name - This is different to the worksheet code module name
SS - emm.com/excel-vba-worksheet
You can use the worksheet code module name in your code which can be useful if you think the user might rename the worksheet.
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext