View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_276_] Rick Rothstein \(MVP - VB\)[_276_] is offline
external usenet poster
 
Posts: 1
Default highlight selected cells in excel and blackout others for sharing

If you can make use of macros in your environment, the following subroutine
can be attached to a CommandButton placed on the worksheet (or a button
placed on the toolbar even) or simply executed via pressing Alt+F8...

Sub ToggleItems()
Dim C As Range
If Selection.Count = 1 Then Exit Sub
If IsNull(Worksheets("Sheet1").UsedRange.Interior.Col orIndex) Then
Worksheets("Sheet1").UsedRange.Interior.ColorIndex = xlNone
Else
For Each C In Worksheets("Sheet1").UsedRange
If Intersect(C, Selection) Is Nothing Then
If Len(C.Value) Then C.Interior.Color = C.Font.Color
End If
Next
End If
End Sub

The way it works is if you have more than one cell selected, all the
non-selected cells will be blacked-out (have their interior color changed to
the same color as the font's color). When activated a second time, the macro
will remove all the black-outs. Note... you will not want to leave your
employee alone with the worksheet as selecting the blacked out cells will
make their content readable.

You could even activate the macro via a right mouse click using event code
something like this...

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)
Dim C As Range
If Selection.Count 1 Then
Cancel = True
If IsNull(Worksheets("Sheet1").UsedRange.Interior.Col orIndex) Then
Worksheets("Sheet1").UsedRange.Interior.ColorIndex = xlNone
Else
For Each C In Worksheets("Sheet1").UsedRange
If Intersect(C, Selection) Is Nothing Then
If Len(C.Value) Then C.Interior.Color = C.Font.Color
End If
Next
End If
End If
End Sub

although, as written, the above will remove the normal right click
functionality when more than one cell is selected.

Rick


"Brian Pruett" <Brian wrote in message
...
This is a suggestion for excel. I would like to be able to highlight
certain
cells and click a button or right click and choose an option that would
black
out the other cells. Example: I am showing an employee their information
on a
payroll spreadsheet which also contains other employee's confidential
information.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow
this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...et.f unctions