ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Temporary formatting of cell with focus (https://www.excelbanter.com/excel-discussion-misc-queries/107749-temporary-formatting-cell-focus.html)

Ricter

Temporary formatting of cell with focus
 
How would one go about setting up a sheet where any cell with the focus would
have, say, a red background?

Gary''s Student

Temporary formatting of cell with focus
 
If by focus you mean select, then try this:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 46
End Sub

put this in worksheet code, not a standard module.
--
Gary''s Student


"Ricter" wrote:

How would one go about setting up a sheet where any cell with the focus would
have, say, a red background?


Ricter

Temporary formatting of cell with focus
 
That works, student of Gary, thanks. One more question, is there a pallet
somewhere I can look at to find those colorindexes? 46 is orange, on my
monitor anyway...

Ricter



"Gary''s Student" wrote:

If by focus you mean select, then try this:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 46
End Sub

put this in worksheet code, not a standard module.
--
Gary''s Student


"Ricter" wrote:

How would one go about setting up a sheet where any cell with the focus would
have, say, a red background?


Gary''s Student

Temporary formatting of cell with focus
 
I don't know. I usually turn on the Macro Recorder and then color a cell. I
look at the generated code to get the value.
--
Gary's Student


"Ricter" wrote:

That works, student of Gary, thanks. One more question, is there a pallet
somewhere I can look at to find those colorindexes? 46 is orange, on my
monitor anyway...

Ricter



"Gary''s Student" wrote:

If by focus you mean select, then try this:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 46
End Sub

put this in worksheet code, not a standard module.
--
Gary''s Student


"Ricter" wrote:

How would one go about setting up a sheet where any cell with the focus would
have, say, a red background?


Peo Sjoblom

Temporary formatting of cell with focus
 
Try here

http://www.mvps.org/dmcritchie/excel...htm#colorindex




--


Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
(Remove ^^ from email)


"Ricter" wrote in message
...
That works, student of Gary, thanks. One more question, is there a pallet
somewhere I can look at to find those colorindexes? 46 is orange, on my
monitor anyway...

Ricter



"Gary''s Student" wrote:

If by focus you mean select, then try this:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 46
End Sub

put this in worksheet code, not a standard module.
--
Gary''s Student


"Ricter" wrote:

How would one go about setting up a sheet where any cell with the focus
would
have, say, a red background?




Gord Dibben

Temporary formatting of cell with focus
 
Ricter

Copy this to a General Module and run it.

Sub ListColorIndexes()
Dim Ndx As Long
Sheets.Add
For Ndx = 1 To 56
Cells(Ndx, 1).Interior.ColorIndex = Ndx
Cells(Ndx, 2).Value = Hex(ThisWorkbook.Colors(Ndx))
Cells(Ndx, 3).Value = Ndx
Next Ndx
End Sub

Note: if you have modified any colors, you will see discrepancies.


Gord Dibben MS Excel MVP

On Wed, 30 Aug 2006 12:42:02 -0700, Ricter
wrote:

That works, student of Gary, thanks. One more question, is there a pallet
somewhere I can look at to find those colorindexes? 46 is orange, on my
monitor anyway...

Ricter



"Gary''s Student" wrote:

If by focus you mean select, then try this:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 46
End Sub

put this in worksheet code, not a standard module.
--
Gary''s Student


"Ricter" wrote:

How would one go about setting up a sheet where any cell with the focus would
have, say, a red background?




All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com