Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Db1712
 
Posts: n/a
Default Highlight Active Cell


Is there a way to highlight a cell currently in use if the sheet is
protected. I found this code in my search however it does not work
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, ByVal
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 Sub


--
Db1712
------------------------------------------------------------------------
Db1712's Profile: http://www.excelforum.com/member.php...o&userid=15912
View this thread: http://www.excelforum.com/showthread...hreadid=320546

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Unprotect the sheet before setting the colorindex, and re-protect
afterwards.

--

HTH

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


"Db1712" wrote in message
...

Is there a way to highlight a cell currently in use if the sheet is
protected. I found this code in my search however it does not work
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, ByVal
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 Sub


--
Db1712
------------------------------------------------------------------------
Db1712's Profile:

http://www.excelforum.com/member.php...o&userid=15912
View this thread: http://www.excelforum.com/showthread...hreadid=320546



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't move a named cell without breaking a hyperlink to that cell Snakeye Links and Linking in Excel 3 January 26th 05 11:57 PM
Display cell value on a chart. Andrew Constantinidis Charts and Charting in Excel 1 January 8th 05 04:36 AM
How do I set a cell to "Empty" so that it does not display in a ch Ian Charts and Charting in Excel 3 January 7th 05 01:12 AM
make a cell empty based on condition mpierre Charts and Charting in Excel 2 December 29th 04 01:01 PM
Transferring cell content between workbooks using cell references Kiwi Mike Excel Discussion (Misc queries) 2 November 27th 04 11:31 PM


All times are GMT +1. The time now is 09:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"