Midavalo
New MemberJoinedApr 23, 2007Messages7Office Version
- 365
- Windows
- Sep 16, 2007
- #1
Hi there,
Is it possible (if so, how) to divide a cell in two (diagonally) and color one half and leave the other half blank/white? Trying to create a calendar type thing and show one of the days as a half day, so shade/color half and leave the other blank.
Thanks,
Mike.
Joe4
MrExcel MVP, Junior AdminJoinedAug 1, 2002Messages66,227Office Version
- 365
- Windows
- Sep 16, 2007
- #2
I don't think that is possible.
What you can do is make the day actually two cells for each day. If you want to center the day number across it, highlight both cells and use Format | Cells | Alignment | Horizontal | Center Across Selection.
Then you can center your entry across both cells, but only color half of it.
KKundepuu
New Member
JoinedSep 29, 2004Messages46
- Sep 16, 2007
- #3
try to something like this
Draw triangel shape and adjust it to cell size fill that color you need and also insert textbox and align text inside it.
Solution
Midavalo
New MemberJoinedApr 23, 2007Messages7Office Version
- 365
- Windows
- Sep 17, 2007
- #4
try to something like this Click to expand...
Thank you for your replies. We ended up doing something similar to this - created a triangle jpg and put it in the cell.
Draw triangel shape and adjust it to cell size fill that color you need and also insert textbox and align text inside it.
Cheers
Fill colors in Excel 2010 and 2013 usually fill each cell with a single solid color, no matter how large the cell in question. To add two background colors to one cell, use the Two Colors fill effect to create a gradient.
Step 1: Format Cells
Select the cell you want to fill, right-click the cell and choose Format Cells.
Advertisement
Video of the Day
Image Credit: Image courtesy of Microsoft
Step 2: Open Fill Effects
Open the Fill tab and click Fill Effects.
Advertisement
You can't combine a two-color effect with a pattern, so leave the Pattern Style blank.
Image Credit: Image courtesy of Microsoft
Step 3: Pick the Two Colors
Choose Two Colors, and then pick the two colors you want to use with the Color 1 and Color 2 selectors.
Here is how to put two colors into a cell. This does not allow you to create two cells from one information wise. You create the appearance of two pieces of information though using font formatting and spacing.
- Right click on the the cell(s)
- Select "Format cells"
- Click on "Fill" tab
- Click on "Fill Effects ..." (below color grid and above "Sample")
- Select the two colors you desire
- Select "Diagonal Up" or "Diagonal Down" under "Shading Styles"
Here is how I accomplished it with VBA
Code:
Sub Macro1() ' ' Macro1 Macro ' With Selection.Interior .Pattern = xlPatternLinearGradient .Gradient.Degree = 90 .Gradient.ColorStops.Clear End With With Selection.Interior.Gradient.ColorStops.Add(0) .ThemeColor = xlThemeColorDark1 .TintAndShade = 0 End With With Selection.Interior.Gradient.ColorStops.Add(1) .ThemeColor = xlThemeColorAccent1 .TintAndShade = 0 End With End Sub
If you want to get rid of the blending add 2 ColorStops to the code like this. Note how the color now switches between 49% and 51% of the cell. I also removed the .TintAndShade lines as they are not important.
Code:
Sub Macro1() ' ' Macro1 Macro ' With Selection.Interior .Pattern = xlPatternLinearGradient .Gradient.Degree = 90 .Gradient.ColorStops.Clear End With With Selection.Interior.Gradient.ColorStops.Add(0) .ThemeColor = xlThemeColorDark1 'First Color End With With Selection.Interior.Gradient.ColorStops.Add(0.49) .ThemeColor = xlThemeColorDark1 'First Color End With With Selection.Interior.Gradient.ColorStops.Add(0.51) .ThemeColor = xlThemeColorAccent1 'Second Color End With With Selection.Interior.Gradient.ColorStops.Add(1) .ThemeColor = xlThemeColorAccent1 'Second Color End With End Sub
A couple of final notes.
- If you are looking for a diagonal or vertical color separation simply change the .Gradient.Degree to the appropriate angle.
- 0 = Vertical
- 45= rising diagonal
- 135 = falling diagonal
- Try .Color instead of .ThemeColor with a line of code like this
- .Color = RGB(255, 206, 0)
- This makes it easy to get whatever color you want all you need are the RGB integer values. Look them up on line or using excel under the More Colors> Custom colors section.