title: Highlight Row-Column of selected cell
body: <p>Be gentle guys, I'm not a programmer.</p>
  
  <p>I got this snippit of code off the internet many many moons ago.  I would give credit, but I don't remember where it came from.</p>
  
  <pre><code>Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
  Static xRow
  Static xColumn
  If xColumn &lt;&gt; "" Then
  With Columns(xColumn)
  .Interior.ColorIndex = xlNone
  End With
  With Rows(xRow)
  .Interior.ColorIndex = xlNone
  End With
  End If
  pRow = Selection.Row
  pColumn = Selection.Column
  xRow = pRow
  xColumn = pColumn
  With Columns(pColumn)
  .Interior.ColorIndex = 19
  .Interior.Pattern = xlSolid
  End With
  With Rows(pRow)
  .Interior.ColorIndex = 19
  .Interior.Pattern = xlSolid
  End With
  End Sub
  </code></pre>
  
  <p>The above code highlights rows and columns of a selected sell.  The problem is that it highlights columns from 1 to 1048576, which causes the vertical scroll bar to get tiny.  Plus if there is any color coding in the spreadsheet it screws that up.  I decided to write my own highlighter.  I put a border around my selected row,column and only do it for 500 rows.  It works, almost.  The problem is that something in my code cancels the copy command, and will not allow me to paste, which did not happen in the code above.  Copy/Paste is a must.  Any help would be greatly appreciated.</p>
  
  <pre><code>Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
  Range("A1:N500").Borders(xlEdgeLeft).Weight = xlThin
  Range("A1:N500").Borders(xlEdgeTop).Weight = xlThin
  Range("A1:N500").Borders(xlEdgeBottom).Weight = xlThin
  Range("A1:N500").Borders(xlEdgeRight).Weight = xlThin
  Range("A1:N500").Borders(xlInsideVertical).Weight = xlThin
  Range("A1:N500").Borders(xlInsideHorizontal).Weight = xlThin
  Range("A1:N500").Borders(xlEdgeLeft).Color = vbBlack
  Range("A1:N500").Borders(xlEdgeTop).Color = vbBlack
  Range("A1:N500").Borders(xlEdgeBottom).Color = vbBlack
  Range("A1:N500").Borders(xlEdgeRight).Color = vbBlack
  Range("A1:N500").Borders(xlInsideVertical).Color = vbBlack
  Range("A1:N500").Borders(xlInsideHorizontal).Color = vbBlack
  Dim SplitAddress() As String
  SplitAddress = Split(ActiveCell.Address, "$")
  Dim RowSelection As String
  RowSelection = "A" &amp; SplitAddress(2) &amp; ":" &amp; "N" &amp; SplitAddress(2)
  Dim ColSelection As String
  ColSelection = SplitAddress(1) &amp; "1" &amp; ":" &amp; SplitAddress(1) &amp; "500"
  With Range(RowSelection)
  .BorderAround Weight:=xlThick, Color:=RGB(255, 0, 0)
  End With
  With Range(ColSelection)
  .BorderAround Weight:=xlThick, Color:=RGB(255, 0, 0)
  End With
  End Sub
  </code></pre>