View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gustavo Marinoni Gustavo Marinoni is offline
external usenet poster
 
Posts: 4
Default highlighting cells with formulas

You can achieve this creating a macro. You have to insert some code in the
event Worksheet_Selectionchange

here is the code
Public rngOldTarget As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not (rngOldTarget Is Nothing) Then
rngOldTarget.Offset(0, 1).Resize(, 5).Value = 0
End If

Target.Offset(0, 1).Resize(, 5).Value = 1
Set rngOldTarget = Target
End Sub

the number 5 in the resize method is the number of columns you would like to
switch from 0 to 1.

If you want to apply this only to certain range, for example only if the
cell selected is within the range A5:A10 add the following to the code :

If Intersect(Range("A5:A10"), Target) Is Nothing Then
Exit Sub
End If

Gustavo.


"Michael Angelo" wrote:

I would like to format rows so that when I hightlight a cell it automatically
changes 1's to 0's such as the following:
39880 Alsace Ct. 0 0 0 0 0 0
when highlight address 39880, it would turn all ones to zeros and once you
un-highlight, it would change them back to 1's. Each zero represents a column.

Any suggestions on how to do this???

Thanks - MIke