Home » excel » c# – Select entire row for a given selected cell

c# – Select entire row for a given selected cell

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have an Excel file with at least 20 columns differently named
and at least 100 rows per column.

I need a way to select an entire
block (all the column for selected row) when a user click on a
given cell.

Right now I have a code like this:

    private void Application_SheetSelectionChange(object Sh, Excel.Range Target)
    {

        Excel.Range activecell = ((Excel.Range)Application.ActiveCell);
        if (Target.Value != null)
            {
               /do something                  
            }

     }

this code select only the selected cell, i need a way to select and check all the adjacent cell to selected one.

How to&Answers:
activecell.EntireRow.select();