Cursor position to get colour

  • Thread starter Thread starter anshad1
  • Start date Start date
A

anshad1

how will get colur in Cursor position only
for ex: my tex in B8, Cursor also in B8 then only B8 to be change
difference colour, how it will work

please help me
Anshad
 
how will get colur in Cursor position only
for ex: my tex in B8, Cursor also in B8 then only B8 to be change
difference colour, how it will work

please help me
Anshad

Your question is not very clear, can you please give the example.
Thanks
AQIB RIZVI
 
Your question is not very clear, can you please give the example.
Thanks
AQIB RIZVI


Dear Aqib Rizvi

My questine is in my worksheet as below:

Name Cont no.

Ahmed 8832875
fiaaz 9878532
Kareem 2354878
Anil 3395874
Vimal 9987582
Nippin 6698574

as like this but when the Cursor in cell that cell to highlight
difference colour, it is possible,
 
Place this macro in your sheet module. You can access that module by
right-clicking on the sheet tab and selecting View Code. Paste this macro
into that module. "X" out of the module to return to your sheet. I chose
the color red by setting the ColorIndex to 3. Change this as you wish. HTH
Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 3
End Sub
 
hey otto.

can we also change the font color?

Otto Moehrbach said:
Place this macro in your sheet module. You can access that module by
right-clicking on the sheet tab and selecting View Code. Paste this macro
into that module. "X" out of the module to return to your sheet. I chose
the color red by setting the ColorIndex to 3. Change this as you wish.
HTH Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 3
End Sub
 
Something like this perhaps: HTH Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Cells.Font.ColorIndex = 0
Target.Interior.ColorIndex = 3
Target.Font.ColorIndex = 43
End Sub
 
Note to OP

This code will wipe out any background color you may currently have in any cell
or the worksheet, not just the activecell.

If the wiping out part is not desirable I would suggest you use Chip Pearson's
Rowliner Add-in which preserves original formatting whilst coloring the
activecell.

http://www.cpearson.com/excel/RowLiner.htm


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top