how to select entire row and column in a sigle cell selection

  • Thread starter Thread starter sabu varoor
  • Start date Start date
S

sabu varoor

i want to select the entire row and entire column on selecting a single cell.
is it possible
 
You can do that with event code. Right click the tab on the worksheet you
want this functionality for and then copy/paste this code into the code
window that appeared...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("D:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Union(Target.EntireColumn, Target.EntireRow).Select
Application.EnableEvents = True
End Sub

You didn't say for what range of cells you want this functionality, so I set
it up for columns D, E and F as an example... just change the range to suit
your needs. If, on the other hand, you want this functionality for the
entire sheet and not just a range of cells on that sheet, use this code
instead...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Union(Target.EntireColumn, Target.EntireRow).Select
Application.EnableEvents = True
End Sub
 
i want to select the entire row and entire column on selecting a single cell.
is it possible

If you want to select both the row and column, but not the whole
sheet, you'll have to use the mouse. CTRL-Click on the row and column
headers. And then you'll have to use Tab to get the proper cell active
if that is what you want.
 
Back
Top