View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.newusers
SoggyCashew SoggyCashew is offline
external usenet poster
 
Posts: 8
Default Color 8 cells on DBL click

Hello, If I clicked on a square/cell how could I get it to color a 4 X 4 cell
"8 cells all together" area with the cell that was clicked being the bottom
left cell? I'm using this code to color the single cell.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel
As Boolean)

Dim BorderColor As Long

If Target.Interior.ColorIndex = 36 Then
Target.Interior.ColorIndex = xlNone
BorderColor = 0
Else
Target.Interior.ColorIndex = 36
BorderColor = -16776961
End If

With Target
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeLeft).Color = BorderColor
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeTop).Color = BorderColor
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Color = BorderColor
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Color = BorderColor
End With

Cancel = True

End Sub

--
Thanks,
Chad