Select Method of Worksheet Object VBA

Select Worksheet method is used to select a cell or a range(collection of cells). Here we are using Select method of worksheet object to select any cell or a range. It is very frequently used method while writing VBA macros, but before selecting any cell or range first activate cell or that particular range which u want to select. Otherwise sometimes it will fail unless your procedure activates the worksheet before using the Select method of worksheet object.



50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates

When we use Select Worksheet Method in VBA?

If we want to selects any single cell or collection of cells, then we use select worksheet method. You can use activate method of worksheet object to make a single cell as active cell.

VBA Select Worksheet Method: Syntax

Here is the example syntax to Select Worksheet using VBA. You can use either a Worksheet name or Worksheet number. Always best practice is to use sheet name.

Worksheets(“Your Worksheet Name”). Select(

Sheets(“Worksheet Number”).Select([Replace])

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”.

Sub Select_Range()
End Sub

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.

Sub Select_Range()
End Sub

VBA Select Worksheet Method: Instructions

Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:

  1. Open an Excel Worksheet
  2. Press Alt+F11 to Open VBA Editor
  3. Insert a Module from Insert Menu
  4. Copy the above code for activating worksheet and Paste in the code window(VBA Editor)
  5. Save the file as macro enabled Worksheet
  6. Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line and observe the selection.

Leave A Comment

Related pages

shortcut keys of excel 2007how to unhide cells in excel 2010unlock macro excelvlookup and hlookup in excel with examplehow to find difference between two dates in excelhow to vlookup in excel 2007 with exampleexcel macro activesheetexcel command buttonssimple macro program in excelhow to hide excel rowssql interview questions and answers in pdfautofilter macrohow do you refresh a pivot tableexcel vba activecell row numberhow to use a sumif formulaexcel pivot table tutorialscreate pivot chart excel 2010vba excel function returnexcel macro programmingadvanced excel vba tutorialhow to create sql query in excelhow to unhide a tab in excel 2010unprotected exceldefining an array in vbavba excel activeworkbookexcel add developer tabexcel vba sample projectsnetezza sql case statementfont.colorindexvba elseexcel macro copy worksheetsample vba code for excel 2010how do i create a hyperlink in excelvba excel delete columnhow to highlight duplicates in excel 2003fancy graphs in excellogical formula excelvba excel open text filevba offset rowcreate formula in excel vbaexcel macro sortaccess 2007 vba tutorialhow to unhide rows in excelvba excel select worksheetsql query excel spreadsheetvlookup stepsexcel dedupe formulavba color numbersdelete sheet in excelexcel vba activeworkbookvba open file for inputwhat is grouping in sqlbelajar ms access 2007hlookup example in excelexcel 2013 average functionvba waitpassword vbaunhide worksheetpastespecial vbaautofit row heightexcel vba pivot tablesvlookup examples excel 2010how to remove duplicates in excel 2007how to use choose function in excellen excel functionhow to get data from another worksheet in excelhr interview questions indiabixarray length in vbaschedule excel templatesvba outlook folderfso.fileexistslock excel with passwordvba pivotcopy worksheet to another workbookhow to learn pivot table in excelunmerge excelexcel dashboards templateshow to unhide all columns