Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]() 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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can't move a named cell without breaking a hyperlink to that cell | Links and Linking in Excel | |||
Display cell value on a chart. | Charts and Charting in Excel | |||
How do I set a cell to "Empty" so that it does not display in a ch | Charts and Charting in Excel | |||
make a cell empty based on condition | Charts and Charting in Excel | |||
Transferring cell content between workbooks using cell references | Excel Discussion (Misc queries) |