I want to do a arrangement for a file like this " wherever cursor moves in excel that particular cell will highlight with color and once it goes to some other cell that last highlighted cell will come as a ordinary cell"
Pls Help....
I want to do a arrangement for a file like this " wherever cursor moves in excel that particular cell will highlight with color and once it goes to some other cell that last highlighted cell will come as a ordinary cell"
Pls Help....
Maybe base something on this:
http://www.extendoffice.com/document...nd-column.html
Regards
Special-K
Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.
No.. this is highlighting Concern Row & Column but i need only highlight that particular active cell.
Try this.....
Right Click on Sheet Tab --> View Code --> Paste the code given below in the code window --> Save your workbook as Excel Macro-Enabled Workbook.
Is this what you are trying to achieve?Private Sub Worksheet_SelectionChange(ByVal Target As Range) ActiveSheet.Cells.Interior.ColorIndex = xlNone Target.Interior.ColorIndex = 6 End Sub
Regards
sktneer
Treat people the way you want to be treated. Talk to people the way you want to be talked to.
Respect is earned NOT given.
Sir, it's very good code but it's removing the color of all the color filled cell.
Hi,
Try the attached file. If you want, you can select a MASTER CELL that contains the color you want to use. If there is no MASTER CELL color, then the default ColorIndex (27 = bright yellow) will be used.
Lewis
Code follows from ThisWorkbook module:
Option Explicit Private Const myGblActiveCellColorIndexMasterSheetNAME As String = "Sheet1" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Set the value of the next line to "" if there is NO MASTER CELL (the default value will be used) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Const myGblActiveCellColorIndexMasterCELL As String = "D5" Private Const myDefaultActiveCellColorINDEX = 27 'Set default to bright Yellow Private myGblActiveCellColorIndex As Long Private myGblLastActiveCell As String Private myGblLastActiveSheet As String Private Sub Workbook_Open() 'Get the last used Worksheet and Cell from the current location of the Active Cell myGblLastActiveSheet = ActiveSheet.Name myGblLastActiveCell = ActiveCell.Address(False, False) End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) 'This colors the active cell and saves the value for future use Dim iError As Long If myGblLastActiveSheet = myGblActiveCellColorIndexMasterSheetNAME And Target.Address(False, False) = myGblActiveCellColorIndexMasterCELL Then 'do nothing - do not uncolor the MASTER Color cell Else 'Get the Active Cell Color Index from the designated cell on the Master Color Index Sheet 'If there is an error or no value, use the default value On Error Resume Next myGblActiveCellColorIndex = Sheets(myGblActiveCellColorIndexMasterSheetNAME).Range(myGblActiveCellColorIndexMasterCELL).Interior.ColorIndex iError = Err.Number If myGblActiveCellColorIndex = xlNone Or iError <> 0 Then myGblActiveCellColorIndex = myDefaultActiveCellColorINDEX End If On Error GoTo 0 'Set the color index of the Active cell - because it is NOT the Master Sheet and Master Color Cell Target.Interior.ColorIndex = myGblActiveCellColorIndex 'Clear the previous Active Cell of color (unless it is the first Active Cell) If Len(myGblLastActiveSheet) > 0 Then Sheets(myGblLastActiveSheet).Range(myGblLastActiveCell).Interior.ColorIndex = xlNone End If 'Save the Active Sheet Name and Active Cell Name for future use myGblLastActiveSheet = Sh.Name myGblLastActiveCell = Target.Address(False, False) End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks