Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Hello
Is it possible to highlight the current cursor cell you are on in colour, to help identify where you are on the spreadsheet, i.e.identify location? For example if you are on cell A1 can it be highlighted in yellow, so when you move on to other cells eg. A10 it then only highlights that cell in yellow. Thank you Susan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Susan,
There is probably a better way...but it can be done with the Change Event. This code appears to work. Private Sub Worksheet_SelectionChange(ByVal Target As Range) ' Range(Cells(1, 1), Cells(65536, 256)).Interior.ColorIndex = xlNone Target.Interior.ColorIndex = 6 ' End Sub It needs to go with the sheet for which you want this to happen. HTH John |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Only via vba, and if you go that route you lose any undo functionality, as
well as taking a little bit of a hit on performance, however if you can live with that then perhaps something like Chip Pearson's free Rowliner addin will do what you want:- http://www.cpearson.com/excel/rowliner.htm -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL 97/00/02/03 ------------------------------*------------------------------*---------------- It's easier to beg forgiveness than ask permission :-) ------------------------------*------------------------------*---------------- "Susan Hayes" wrote in message ... Hello Is it possible to highlight the current cursor cell you are on in colour, to help identify where you are on the spreadsheet, i.e.identify location? For example if you are on cell A1 can it be highlighted in yellow, so when you move on to other cells eg. A10 it then only highlights that cell in yellow. Thank you Susan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Here is another alternative '---------------------------------------------------------------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target With .EntireRow ..FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlTop) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With With .Borders(xlBottom) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With ..Interior.ColorIndex = 20 End With End With With .EntireColumn ..FormatConditions.Delete ..FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlLeft) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With With .Borders(xlRight) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With ..Interior.ColorIndex = 20 End With End With ..FormatConditions.Delete ..FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" ..FormatConditions(1).Interior.ColorIndex = 36 End With End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- Bob Phillips ------------------------------------------------------------------------ Bob Phillips's Profile: http://www.excelforum.com/member.php...o&userid=26952 View this thread: http://www.excelforum.com/showthread...hreadid=401700 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Bob,
Just want to say thanks for your code example. IMO, this is the best I've seen on the subject. Greg Wilson "Bob Phillips" wrote: Here is another alternative '---------------------------------------------------------------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target With .EntireRow .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With With .Borders(xlBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With .Interior.ColorIndex = 20 End With End With With .EntireColumn .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With With .Borders(xlRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With .Interior.ColorIndex = 20 End With End With .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = 36 End With End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- Bob Phillips ------------------------------------------------------------------------ Bob Phillips's Profile: http://www.excelforum.com/member.php...o&userid=26952 View this thread: http://www.excelforum.com/showthread...hreadid=401700 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Hi Bob:
Very pretty, after adding in a bunch of periods that I think you may have been missing <g: Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target With .EntireRow ..FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlTop) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With With .Borders(xlBottom) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With ..Interior.ColorIndex = 20 End With End With With .EntireColumn ..FormatConditions.Delete ..FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlLeft) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With With .Borders(xlRight) ..LineStyle = xlContinuous ..Weight = xlThin ..ColorIndex = 5 End With ..Interior.ColorIndex = 20 End With End With ..FormatConditions.Delete ..FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" ..FormatConditions(1).Interior.ColorIndex = 36 End With End Sub Regards, Vasant "Bob Phillips" wrote in message news:Bob.Phillips.1usluc_1125767115.7322@excelforu m-nospam.com... Here is another alternative '---------------------------------------------------------------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target With .EntireRow FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlTop) LineStyle = xlContinuous Weight = xlThin ColorIndex = 5 End With With .Borders(xlBottom) LineStyle = xlContinuous Weight = xlThin ColorIndex = 5 End With Interior.ColorIndex = 20 End With End With With .EntireColumn FormatConditions.Delete FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlLeft) LineStyle = xlContinuous Weight = xlThin ColorIndex = 5 End With With .Borders(xlRight) LineStyle = xlContinuous Weight = xlThin ColorIndex = 5 End With Interior.ColorIndex = 20 End With End With FormatConditions.Delete FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" FormatConditions(1).Interior.ColorIndex = 36 End With End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- Bob Phillips ------------------------------------------------------------------------ Bob Phillips's Profile: http://www.excelforum.com/member.php...o&userid=26952 View this thread: http://www.excelforum.com/showthread...hreadid=401700 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Alternate methods to Bobs here http://www.mrexcel.com/board2/viewtopic.php?t=14546 Also note from that link the international version as "True" is different in different languages. Sub links provide alternate Non conditional formating options. -- Ivan F Moala ------------------------------------------------------------------------ Ivan F Moala's Profile: http://www.excelforum.com/member.php...fo&userid=1954 View this thread: http://www.excelforum.com/showthread...hreadid=401700 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Even prettier after running Robs indenter against it :-)
Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target With .EntireRow .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With With .Borders(xlBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With .Interior.ColorIndex = 20 End With End With With .EntireColumn .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" With .FormatConditions(1) With .Borders(xlLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With With .Borders(xlRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 5 End With .Interior.ColorIndex = 20 End With End With .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = 36 End With End Sub Regards Ken........................ <snip |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
Just don't miss my caveat in that this effectively removes any undo
capability, so closing the workbook and not saving is the only way back if you screw anything up. Regards Ken...................... "Greg Wilson" wrote in message ... Bob, Just want to say thanks for your code example. IMO, this is the best I've seen on the subject. Greg Wilson <snip |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cursor cell in colour
OK - here's my 5c worth. This even keeps the Undo bit.
Select some cells or the whole sheet, and apply this Conditional format formula. Then pick your desired format to show the rows and columns. =OR(CELL("col")=COLUMN(),CELL("row")=ROW()) For the sheets event we need to force a calculation each time a cell is selected. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Calculate End Sub That's it! - enjoy. Regards Robert McCurdy "Ken Wright" wrote in message ... Just don't miss my caveat in that this effectively removes any undo capability, so closing the workbook and not saving is the only way back if you screw anything up. Regards Ken...................... "Greg Wilson" wrote in message ... Bob, Just want to say thanks for your code example. IMO, this is the best I've seen on the subject. Greg Wilson <snip |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how can i change the colour of cursor only | Excel Discussion (Misc queries) | |||
I want to change the colour of the cell cursor in Excel 2003. | Excel Discussion (Misc queries) | |||
Cursor position to get colour | Excel Worksheet Functions | |||
change colour of cursor | Excel Discussion (Misc queries) | |||
How do i highlight the cursor in a different colour on excel? | Excel Discussion (Misc queries) |