View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Matthew Herbert[_3_] Matthew Herbert[_3_] is offline
external usenet poster
 
Posts: 149
Default Macro to select / highlight entire row.

Ross,

I would recommend that you not change the native Excel navigation keys. Why
not create a shortcut (OnKey Method) that calls a macro to select/highlight
the data? (You can tie the SetupShortcut and DestroyShortcut to the workbook
open and close events. Or you can run these however you desire. Also, I
chose Ctrl+q as the shortcut below; you can change the shortcut to be
something you desire, but Ctrl+q is not a native Excel shortcut).

Best,

Matthew Herbert

Option Explicit

Sub SelectCells()
Dim strColStart As String
Dim strColEnd As String
Dim lngRow As Long

strColStart = "A"
strColEnd = "Z"
lngRow = ActiveCell.Row

Range(strColStart & lngRow, strColEnd & lngRow).Select

End Sub

Sub SetupShortcut()
Application.OnKey "^q", "SelectCells"
End Sub

Sub DestroyShortcut()
Application.OnKey "^q"
End Sub

"Ross" wrote:


How can I get Excel to select an entire row when I use the "Arrow UP" key or
the "Arrow Down" key?

For Example, if the cursor has selected Cell A3 and I "Arrow Down" to A4,
the cursor would then select the ENTIRE A4 ROW (this spreadsheet has data in
some of the A:Z columns (columns are not consistently filled for all cell
A4:Z4).

This will help the viewer see all of the A4:Z4 cells highlighted (kind of a
custom user input aid).

Many Thanks

Ross