+ Reply to Thread
Results 1 to 5 of 5

editing code to change colour scales.

  1. #1
    Registered User
    Join Date
    10-15-2010
    Location
    southampton, england
    MS-Off Ver
    Excel 2007
    Posts
    5

    editing code to change colour scales.

    hello

    I need some help editing a piece of code. i would like to know how to edit some code so that the colour scales used in the code are changed. At the moment in the code given on the below link, it highlights high numbers in red and low numbers in green. I would like to know how to reverse this please so high numbrs are in green.

    thanks


    http://www.excelforum.com/excel-gene...le-sheets.html
    Last edited by shub; 05-15-2014 at 03:44 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: editing code to change colour scales.

    Your link does not work.

    If all you want to do is switch the colours can you not just edit the colour values.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-15-2010
    Location
    southampton, england
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: editing code to change colour scales.

    Hi ,

    I tried just changing the colour scale type from 3 to 1 to see what that did but then when i tried to run the code it would not work. apologies but im very new to vba.

    thanks

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    Dim rngData As Range
    Dim rngRow As Range
    Dim xx As Worksheet

    ActiveSheet.Cells.FormatConditions.Delete

    Set rngData = Range("B2:X219")
    For Each rngRow In rngData.Rows
    With rngRow
    .FormatConditions.AddColorScale ColorScaleType:=3
    .FormatConditions(.FormatConditions.Count).SetFirstPriority
    .FormatConditions(1).ColorScaleCriteria(1).Type = xlConditionValueLowestValue
    With .FormatConditions(1).ColorScaleCriteria(1).FormatColor
    .Color = 8109667
    .TintAndShade = 0
    End With
    .FormatConditions(1).ColorScaleCriteria(2).Type = xlConditionValuePercentile
    .FormatConditions(1).ColorScaleCriteria(2).Value = 50
    With .FormatConditions(1).ColorScaleCriteria(2).FormatColor
    .Color = 8711167
    .TintAndShade = 0
    End With
    .FormatConditions(1).ColorScaleCriteria(3).Type = xlConditionValueHighestValue
    With .FormatConditions(1).ColorScaleCriteria(3).FormatColor
    .Color = 7039480
    .TintAndShade = 0
    End With
    End With
    Next

    End Sub

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: editing code to change colour scales.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-15-2010
    Location
    southampton, england
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: editing code to change colour scales.

    thanks very much that works great now.

    sorry about the code i sent.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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