Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cursor cell in colour

34 views
Skip to first unread message

Susan Hayes

unread,
Sep 3, 2005, 10:10:18 AM9/3/05
to
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

johnhi...@charter.net

unread,
Sep 3, 2005, 11:03:19 AM9/3/05
to
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

Ken Wright

unread,
Sep 3, 2005, 11:05:28 AM9/3/05
to
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" <as...@hotmail.com> wrote in message
news:1abjh1hfq64g4317i...@4ax.com...

Bob Phillips

unread,
Sep 3, 2005, 12:33:28 PM9/3/05
to

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?action=getinfo&userid=26952
View this thread: http://www.excelforum.com/showthread.php?threadid=401700

Greg Wilson

unread,
Sep 3, 2005, 10:03:02 PM9/3/05
to
Bob,

Just want to say thanks for your code example. IMO, this is the best I've
seen on the subject.

Greg Wilson

Vasant Nanavati

unread,
Sep 3, 2005, 11:43:55 PM9/3/05
to
Hi Bob:

Very pretty, after adding in a bunch of periods that I think you may have
been missing <g>:

End Sub

Regards,

Vasant

"Bob Phillips" <Bob.Phillips.1usl...@excelforum-nospam.com>
wrote in message
news:Bob.Phillips.1usl...@excelforum-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"

Ivan F Moala

unread,
Sep 4, 2005, 3:51:01 AM9/4/05
to

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?action=getinfo&userid=1954

Ken Wright

unread,
Sep 4, 2005, 5:04:09 AM9/4/05
to
Even prettier after running Robs indenter against it :-)

End Sub

Regards
Ken........................

<snip>


Ken Wright

unread,
Sep 4, 2005, 5:07:12 AM9/4/05
to
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" <GregW...@discussions.microsoft.com> wrote in message
news:EC0ED80B-B712-4247...@microsoft.com...


> Bob,
>
> Just want to say thanks for your code example. IMO, this is the best I've
> seen on the subject.
>
> Greg Wilson
>

<snip>


Robert McCurdy

unread,
Sep 4, 2005, 1:36:53 PM9/4/05
to
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" <ken.w...@NOSPAMntlworld.com> wrote in message news:usf0KATs...@tk2msftngp13.phx.gbl...

0 new messages