Highlight Active Cell

  • Thread starter Thread starter Db1712
  • Start date Start date
D

Db1712

Is there a way to highlight a cell currently in use if the sheet i
protected. I found this code in my search however it does not wor
with a protected sheet. Thanks for any help with this in advance.




1. Use ALT + F11 to open the VB editor
2. Double click 'ThisWorkbook' in the Project Explorer
3. Paste the following:
Dim PrevCellCol As Long, PrevCellRow As Long

4. In the Code, select 'Workbook' -> Workbook_SheetSelectionChange
5. Paste the Following:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVa
Target As Range)
If PrevCellCol = 0 Then
PrevCellCol = ActiveCell.Column
PrevCellRow = ActiveCell.Row
Else
Cells(PrevCellRow, PrevCellCol).Interior.ColorIndex = xlNone
End If
ActiveCell.Interior.ColorIndex = 22
PrevCellCol = ActiveCell.Column
PrevCellRow = ActiveCell.Row
End Su
 
Unprotect the sheet before setting the colorindex, and re-protect
afterwards.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top