Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.newusers
|
|||
|
|||
To format a cell pattern by VBA
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 |
#2
Posted to microsoft.public.excel.newusers
|
|||
|
|||
To format a cell pattern by VBA
Why do you need VBA? Why don't you instead use Conditional Formatting?
Format--Conditional Formatting. **************************** Hope it helps! Anne Troy www.OfficeArticles.com **************************** "Robin Chapple" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.newusers
|
|||
|
|||
To format a cell pattern by VBA
Since the OP's already running an event macro to change the cell
contents, using VBA to format the cell has several advantages: (1) Simplicity - controlling changes to the double-clicked cell in one place rather than 2, (2) The OP indicated that the initiating event for the color should be the double-click, not the content (that *might* work the same, but it wasn't stated that way), and (3) The OP didn't indicate that the color would continue to be dependent on the cell content, so CF might be appropriate or not - there's not enough info to tell. In article , "Anne Troy" wrote: Why do you need VBA? Why don't you instead use Conditional Formatting? Format--Conditional Formatting. **************************** Hope it helps! |
#5
Posted to microsoft.public.excel.newusers
|
|||
|
|||
To format a cell pattern by VBA
Many thanks Anne. That worked as planned. Robin On Sun, 25 Mar 2007 00:56:32 -0400, "Anne Troy" wrote: Why do you need VBA? Why don't you instead use Conditional Formatting? Format--Conditional Formatting. **************************** Hope it helps! Anne Troy www.OfficeArticles.com **************************** "Robin Chapple" wrote in message .. . 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cell pattern footer | Excel Discussion (Misc queries) | |||
Cell pattern | Excel Discussion (Misc queries) | |||
Cell pattern | Excel Discussion (Misc queries) | |||
countif cell pattern = | Excel Worksheet Functions | |||
Cell Pattern | Excel Discussion (Misc queries) |