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.