Results 1 to 4 of 4

Help with colors in an existing code excel 2010

Threaded View

hwminich Help with colors in an... 01-23-2020, 12:03 PM
shg Re: Help with colors in an... 01-23-2020, 12:36 PM
shg Re: Help with colors in an... 01-23-2020, 01:42 PM
hwminich Re: Help with colors in an... 01-23-2020, 02:42 PM
  1. #1
    Registered User
    Join Date
    03-20-2015
    Location
    Buffalo, NY
    MS-Off Ver
    2010
    Posts
    21

    Help with colors in an existing code excel 2010

    Hi, I have this code that is working to create a cell with two colors in it, however I would like to use two different colors and whenever I try to change the colors the code breaks.
    here is the two colors:
    color 1 color 2

    here is the 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
    Last edited by hwminich; 01-23-2020 at 12:59 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA code to change Excel chart bar colors as per cell colors
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2016, 03:29 AM
  2. [SOLVED] VBA code to copy range of table from Excel 2010 to (existing) ppt (looping through a list)
    By megaheinz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2016, 04:29 AM
  3. Cell fill colors in Excel 2010
    By ladyglas in forum Excel General
    Replies: 3
    Last Post: 01-31-2015, 12:21 PM
  4. New theme colors, Excel 2010
    By abbassi in forum Excel General
    Replies: 0
    Last Post: 06-26-2014, 04:58 AM
  5. Excel 2010 font and background colors
    By Wyldemaverick in forum Excel General
    Replies: 1
    Last Post: 07-25-2012, 04:05 PM
  6. Excel 2010 - Cannot add colors to a charts data table
    By venetian_jigsaw in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-11-2011, 01:57 PM
  7. Convert Existing Chart Colors to Defaults (Excel 2007)
    By Aardvark in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 10-05-2010, 06:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1