top of page

Some basic Visual Basic to select rows


Occasionally in Excel, you'll want to select all of the instances of rows with a single value on the spreadsheet without applying a filter or sorting the data. For example you may need to run a macro which will merge all of the cells in a row, which will won't function while the data is filtered.

1. Search for a the value in a column by selecting the column, pressing CTRL + F , and clicking Find All. In this example, we're searching for pitchers who have won exactly 20 games in a season.

2. The Excel Find tool will display a list of cell references where the values appears. In the results list, press CTRL + A, and then click close.

3. You'll see that all of the individual cells where the value appears are now selected.

4.Go to View . . . Macros . . . View Marcos and enter a new macro name, 'selectrows', for example. Then click 'Create'.

5. Visual Basic will open. Between the Sub and End Sub commands type in: Selection.entirerow.select

6. Press the play button in Visual Basic, or go back to the Marcos dialog box and run the 'selectrows' macro.

7. You should now see all of the rows on your spreadsheet selected that have the searched for value.


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page