Where Replace is the Optional parameter. When the value is True, it will replace the current selection. When the value is False, it will extend the current selection.
Select is the method of Workbook object is used to makes current sheet as active sheet.
VBA Select Worksheet Method: Example 1
Please see the below VBA procedure. In this procedure we are activating and selecting a Range(“A1”) in the worksheet named “Project1”.
VBA Select Worksheet Method: Example 2
Please see the below VBA code or macro procedure to Select Worksheet. In this example we are activating first Worksheet in the active workbook.
VBA Select Worksheet Method: Instructions
Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:
- Open an Excel Worksheet
- Press Alt+F11 to Open VBA Editor
- Insert a Module from Insert Menu
- Copy the above code for activating worksheet and Paste in the code window(VBA Editor)
- Save the file as macro enabled Worksheet
- Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line and observe the selection.