Consulting

Results 1 to 4 of 4

Thread: Solved: colorindex = xlnone ?

  1. #1
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location

    Solved: colorindex = xlnone ?

    Does someone have the same experience when using this line[VBA]Cells.Interior.ColorIndex = xlNone[/VBA] the cell colors turquoise instead of removing the color and when using this [VBA]Cells.Interior.ColorIndex = xlColorIndexNone[/VBA]the cell color is indead removed.

    Charlize

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    How about using something like:
    [vba]Sub cfind()
    For Each cell In Selection
    If cell.Interior.ColorIndex <> xlNone Then
    MsgBox "Found Colour at " & cell.Address & "This Colour Index " & cell.Interior.ColorIndex
    End If
    Next
    End Sub
    [/vba]this will search your selected range and provide you with the cell address and the colour index!J ust in case there some underlying format or if it was an import from a website etc.
    Regards,
    SImon
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Check for conditional formatting.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Sorry Malcom i should have thought of that!

    [vba]
    Sub cfind()
    For Each cell In Selection
    If cell.Interior.ColorIndex <> xlNone Then
    MsgBox "Found Colour at " & cell.Address & "This Colour Index " & cell.Interior.ColorIndex
    End If
    Next
    Selection.FormatConditions.Delete
    End Sub
    [/vba]if you dont want to use VBA to delete format conditions you can always press Ctrl+A twice! and then go to conditional formatting and delete.

    Regards,
    SImon
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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