Table of Contents
In this blog, we will talk about how to select the entire worksheet in a workbook using VBA. To select all cells of a worksheet we can use it. cells property of the worksheet.
This code will select all cells of an active worksheet.
Sub KDataScience_SelectAllCellsOfWorksheet() Sheet4.Activate Cells.Select End Sub
If we want to select all cells of a worksheet which is not an active worksheet then we need to first activate the worksheet then select the entire cells. If we do not activate the worksheet then it will show error.
Sub KDataScience_SelectEntireSheet() 'To activate sheet Worksheets("sheet4").Activate 'To select the entire cells of activesheet Cells.Select End Sub
If you want to select entire cells of a worksheet then you can use any code shown above (according to one need).
Krishna is a Subject Matter Expert in the field of Excel and Access Automation using VBA, Data Analytics, BI Reporting, and Software Development. He has 12+ years of experience of handling and presenting Decision Oriented data to Business Leaders and executing end to end software development and Automation projects.