If the Project Explorer is not visible, click View, Project Explorer.Ģ.
Here we learn how to use the activate method in VBA to activate a particular excel sheet along with practical examples and downloadable templates.To create this Userform, execute the following steps.ġ. This has been a guide to VBA Activate Sheet.
This code not only activates the sheet “Sales 2016” but also selects the range of cells from A1 to A10. #2 – Select Methodīy using the Select method, we can actually perform other tasks as well. #1 – Activate Methodīy using the Activate method, we can only activate the specified worksheet.Īs we know, this code will select the worksheet “Sales 2016”. There is a slight difference between these two methods. We can use methods to perform the same action, i.e., Activate and Select methods. In the place of a sheet index number, we need to mention the sheet name in double-quotes. Now we will see how to activate sheets by its name. So, it is always a safe option to activate the sheet by its name. In my view, it has to select the “Sales 2017” sheet, but it will select the “Sales 2016” sheet because in the order, “Sales 2016” is the third sheet. Now I will use the sheet index number as 3 and see what happens.
Now technically, “Sales 2017” is my third sheet, and “Sales 2016 is my second sheet.
Now I will interchange the 2 nd and third sheets. This will activate the third sheet, i.e., “Sales 2017”. If I want to activate the 3 rd sheet, I will use 3 as the sheet index number. When you run the code using the F5 key or manually then, this will activate the second sheet, i.e., “Sales 2016”. Now, if I want to select the 2 nd sheet, I will use the Worksheet object and mention the sheet index number as 2. One is by using sheet index numbers, and another one is by using the sheet name itself. Here worksheet is the object, and activates are the method.įor example, I have created three sheets named “Sales 2015”, “Sales 2016”, and “Sales 2017”. So, the syntax of the Activate method is as follows. For example, if you want to activate a sheet called “Sales,” then you can use the below code. To activate the sheet, we need to mention the exact worksheet name by using worksheets object. Source: VBA Activate Sheet () What is VBA Activate Method?Īs the name says, it activates the specified worksheet. You are free to use this image on your website, templates etc, Please provide us with an attribution link How to Provide Attribution? Article Link to be Hyperlinked However, in VBA, it is not that easy we need to specify the sheet name we are referring to, then we can use the “Select” method to select the sheet.
read more, or we directly select the sheet by clicking on them.
In regular spreadsheet workings, we directly navigate thorough shortcut keys Shortcut Keys An Excel shortcut is a technique of performing a manual task in a quicker way. Worksheets have their own name to identify better. In excel, we always work with worksheets. While working in VBA we sometimes refer to another sheet or use another sheet’s properties, suppose we are in sheet 1 working but we want a value from cell A2 in sheet 2, if we refer to sheet 2’s value without activating the sheet first then we will not be able to access the value so to activate a sheet in VBA we use worksheet property as Worksheets(“Sheet2”).Activate.