Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Show/Hide a Secret Cell

I am wondering if it would be possible to implement a feature, whereby a
cell which contains information hidden as grey text on a grey background,
could automatically change to black on grey in response to mouse movement
over the cell in question. There do not seem to be standard spreadsheet
events to trigger the 2 necessary macros.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Show/Hide a Secret Cell

Try something like the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$3" Then
Target.Font.ColorIndex = 1
Else
Range("$C$3").Font.ColorIndex = 15
End If
End Sub

Put this code in the sheet module for the appropriate sheet.
Change $C$3 to the cell in question and change the 15 to the
correct colorindex value.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Hotbird" wrote in message
...
I am wondering if it would be possible to implement a feature,

whereby a
cell which contains information hidden as grey text on a grey

background,
could automatically change to black on grey in response to mouse

movement
over the cell in question. There do not seem to be standard

spreadsheet
events to trigger the 2 necessary macros.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Show/Hide a Secret Cell

Many thanks for your suggestion Chip

I am using a very simple test spreadsheet - one page only called "Sheet1",
with text "11" in cell A1 with both font and background colour set grey.
There is no Module, but Sheet1 has the following code:

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
MsgBox "This Code is active 1"
Target.Font.Color.Index = 1 ' black text
Else
MsgBox "This Code is active 2"
Range("$A$1").Font.Color.Index = 15 'grey text
End If
End Sub

I click on cell A1, but unfortunately, get a run-time error '424' saying
"Object Required" and the Debug window highlights in yellow the line:
Target.Font.Color.Index=1. Have I missed something obvious?

Thank you again for taking the time to help.

"Chip Pearson" wrote in message
...
Try something like the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$3" Then
Target.Font.ColorIndex = 1
Else
Range("$C$3").Font.ColorIndex = 15
End If
End Sub

Put this code in the sheet module for the appropriate sheet.
Change $C$3 to the cell in question and change the 15 to the
correct colorindex value.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Hotbird" wrote in message
...
I am wondering if it would be possible to implement a feature,

whereby a
cell which contains information hidden as grey text on a grey

background,
could automatically change to black on grey in response to mouse

movement
over the cell in question. There do not seem to be standard

spreadsheet
events to trigger the 2 necessary macros.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Show/Hide a Secret Cell

Chip didn't have:
Target.Font.Color.Index
he had
Target.Font.ColorIndex

(no dot in colorindex--for both parts)



Hotbird wrote:

Many thanks for your suggestion Chip

I am using a very simple test spreadsheet - one page only called "Sheet1",
with text "11" in cell A1 with both font and background colour set grey.
There is no Module, but Sheet1 has the following code:

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
MsgBox "This Code is active 1"
Target.Font.Color.Index = 1 ' black text
Else
MsgBox "This Code is active 2"
Range("$A$1").Font.Color.Index = 15 'grey text
End If
End Sub

I click on cell A1, but unfortunately, get a run-time error '424' saying
"Object Required" and the Debug window highlights in yellow the line:
Target.Font.Color.Index=1. Have I missed something obvious?

Thank you again for taking the time to help.

"Chip Pearson" wrote in message
...
Try something like the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$3" Then
Target.Font.ColorIndex = 1
Else
Range("$C$3").Font.ColorIndex = 15
End If
End Sub

Put this code in the sheet module for the appropriate sheet.
Change $C$3 to the cell in question and change the 15 to the
correct colorindex value.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Hotbird" wrote in message
...
I am wondering if it would be possible to implement a feature,

whereby a
cell which contains information hidden as grey text on a grey

background,
could automatically change to black on grey in response to mouse

movement
over the cell in question. There do not seem to be standard

spreadsheet
events to trigger the 2 necessary macros.





--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Show/Hide a Secret Cell


Change both occurrences of
Color.Index
to
ColorIndex

ColorIndex is all one word.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Hotbird" wrote in message
...
Many thanks for your suggestion Chip

I am using a very simple test spreadsheet - one page only called

"Sheet1",
with text "11" in cell A1 with both font and background colour

set grey.
There is no Module, but Sheet1 has the following code:

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
MsgBox "This Code is active 1"
Target.Font.Color.Index = 1 ' black text
Else
MsgBox "This Code is active 2"
Range("$A$1").Font.Color.Index = 15 'grey text
End If
End Sub

I click on cell A1, but unfortunately, get a run-time error

'424' saying
"Object Required" and the Debug window highlights in yellow the

line:
Target.Font.Color.Index=1. Have I missed something obvious?

Thank you again for taking the time to help.

"Chip Pearson" wrote in message
...
Try something like the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$3" Then
Target.Font.ColorIndex = 1
Else
Range("$C$3").Font.ColorIndex = 15
End If
End Sub

Put this code in the sheet module for the appropriate sheet.
Change $C$3 to the cell in question and change the 15 to the
correct colorindex value.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Hotbird" wrote in message
...
I am wondering if it would be possible to implement a

feature,
whereby a
cell which contains information hidden as grey text on a

grey
background,
could automatically change to black on grey in response to

mouse
movement
over the cell in question. There do not seem to be

standard
spreadsheet
events to trigger the 2 necessary macros.










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 show/hide the cell comment blocks ? raymond New Users to Excel 1 June 19th 09 05:47 PM
Show or Hide control characters in a cell (using Excel 2007)... TK Excel Discussion (Misc queries) 0 June 5th 09 05:19 PM
show or Hide cell comment when mouse hovers in Excel? Abi Excel Worksheet Functions 1 May 28th 09 05:47 PM
how do I hide the #N/A to not show in the cell Dylan @ UAFC[_2_] Excel Worksheet Functions 1 December 12th 08 01:05 AM
How do you show/hide individual cell gridlines in Excel 2007? Joy Excel Discussion (Misc queries) 2 June 6th 08 04:41 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"