View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default To format a cell pattern by VBA

One way:

Modify your existing code to add the color at the same time, for
instance:

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Excel.Range, Cancel As Boolean)
If Not Intersect(Target.Cells, Range("A2:J100")) Is Nothing Then
With Target
.Value = "Present"
.Interior.ColorIndex = 37
End With
End If
End Sub


In article ,
Robin Chapple wrote:

I have a worksheet that records attendance with code that enters
"Present" when double clicked.

Can I have VBA code to format the pattern to a colour?

Thanks for your help,

Robin Chapple