Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default 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
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
how can i change the colour of cursor only santan colasso Excel Discussion (Misc queries) 0 July 6th 09 10:39 AM
I want to change the colour of the cell cursor in Excel 2003. Alphalacey Excel Discussion (Misc queries) 1 January 21st 09 05:55 AM
Cursor position to get colour [email protected] Excel Worksheet Functions 6 November 30th 07 01:27 AM
change colour of cursor Jimbo Excel Discussion (Misc queries) 2 September 27th 07 04:56 PM
How do i highlight the cursor in a different colour on excel? Jackie Royan Excel Discussion (Misc queries) 1 December 2nd 05 03:38 PM


All times are GMT +1. The time now is 05:59 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"