Question : Need Visual Basic help with formatting in Excel

Hello,

I have seen a similar question but couldn't get the answer to work for me.

I have a spreadsheet you can view it at www.genniferdoucette.com/excel.html

I need some help adding a VB code.  

Sheet 1 has a calendar of 12 months and a legend of colors, each color represents a task. The client would work on sheet 1 filling cells with colors this is their work plan for the year.  
So for example January 15th they might need to send out a newsletter they would fill that cell with Blue.

Sheets 2 through 13 represent each month (Sheet 2 is January).  I would need sheet 2 to automatically fill the cell that represents January 15th with blue once it has been done on sheet 1.

Thank you.

 

Answer : Need Visual Basic help with formatting in Excel

Gennifer,
I don't know how you planned to change the color of the cells in the master worksheet, but it wasn't easy when I was testing my code.

I therefore wrote a routine that is triggered when you doubleclick a cell in the calendar. It asks you which cell you want to copy the color from, then does it for you. This sub must be installed in the code pane for the master worksheet (Sheet1 in your sample workbook), and won't work at all if installed anywhere else!

Brad
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim celColor As Range, rgCalendars As Range, targ As Range
Dim i As Long, j As Long
Set rgCalendars = Union([A5:G9], [I5:O9], [Q5:W9], [A13:G17], [I13:O17], [Q13:W17], _
    [A21:G25], [I21:O25], [Q21:W25], [A29:G33], [I29:O33], [Q29:W33])
Set targ = Intersect(Target, rgCalendars)
If targ Is Nothing Then Exit Sub

Cancel = True
On Error Resume Next
Set celColor = Application.InputBox("Please click on the cell with color you want to copy", Type:=8)
On Error GoTo 0
If Not celColor Is Nothing Then
    targ.Interior.Color = celColor.Interior.Color
End If
End Sub
Random Solutions  
 
programming4us programming4us