Calendar Coding Using Conditional Formula With A Color Code Of Users Choosing


New Member
Oct 26, 2009
I'm having trouble learning this "loop" feature in vba, or even if it's the correct way to do what I'm wanting. I'm looking at changing the day's background fill, or the "interior". I figured out how to do it one box at time, but it seems as though that probably isn't the BEST way to do it and would probably make you professionals cringe. The version I was going to work on is below (I'm sure it's not even correct but I was piecing together what I found on the web to try and make it work), but I'll put that to the side until I hear from you more experienced VBAers.

Appreciate any help you have time to afford me!!!

    Dim rng As Range    

Set rng = Range("a10:c16")
            With Sheet2.Range("10:16")
    End With
            With Range("a10:c16")
                        .FormatConditions.Add Type:=xlExpression, Formula1:="=$C$10=""t"""
             With .FormatConditions(.FormatConditions.Count)
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = Sheet1.Range("h2")
                .TintAndShade = 0
            End With
        End With
    End With

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...