+ Reply to Thread
Results 1 to 5 of 5

Clear color but not pattern?

  1. #1
    jayklmno
    Guest

    Clear color but not pattern?

    I am having issues with the cell color changing and updating, and removing
    pattern information in the same cell.

    I need to look through a data and color it a certain color and when the data
    is revised, I uncolor it. Users have added patterns to denote other stuff and
    the remove color as desribed below, also removes the pattern. Is there a way
    to remove the color and retain the pattern?

    If Cells(x, y).Interior.ColorIndex = 8 Then
    Cells(x, y).Interior.ColorIndex = xlNone
    End If

    Thanks,
    Jay

  2. #2
    John Fuller
    Guest

    Re: Clear color but not pattern?

    Try this:

    If Cells(x, y).Interior.ColorIndex = 8 Then
    myPattern = Cells(x,y).Interior.Pattern
    Cells(x, y).Interior.ColorIndex = xlNone
    Cells(x, y).Interior.Pattern = myPatter
    End If

    jayklmno wrote:
    > I am having issues with the cell color changing and updating, and removing
    > pattern information in the same cell.
    >
    > I need to look through a data and color it a certain color and when the data
    > is revised, I uncolor it. Users have added patterns to denote other stuff and
    > the remove color as desribed below, also removes the pattern. Is there a way
    > to remove the color and retain the pattern?
    >
    > If Cells(x, y).Interior.ColorIndex = 8 Then
    > Cells(x, y).Interior.ColorIndex = xlNone
    > End If
    >
    > Thanks,
    > Jay



  3. #3
    Les
    Guest

    RE: Clear color but not pattern?

    Retain the pattern with a variable and reapply it.
    i.e.

    Dim myPattern as long

    If Cells(x, y).Interior.ColorIndex = 8 Then
    myPattern = Cells(x, y).Interior.Pattern
    Cells(x, y).Interior.ColorIndex = xlNone
    Cells(x, y).Interior.Pattern = myPattern
    End If


    --
    Les Torchia-Wells


    "jayklmno" wrote:

    > I am having issues with the cell color changing and updating, and removing
    > pattern information in the same cell.
    >
    > I need to look through a data and color it a certain color and when the data
    > is revised, I uncolor it. Users have added patterns to denote other stuff and
    > the remove color as desribed below, also removes the pattern. Is there a way
    > to remove the color and retain the pattern?
    >
    > If Cells(x, y).Interior.ColorIndex = 8 Then
    > Cells(x, y).Interior.ColorIndex = xlNone
    > End If
    >
    > Thanks,
    > Jay


  4. #4
    jayklmno
    Guest

    Re: Clear color but not pattern?

    Thanks, Gents!

    "John Fuller" wrote:

    > Try this:
    >
    > If Cells(x, y).Interior.ColorIndex = 8 Then
    > myPattern = Cells(x,y).Interior.Pattern
    > Cells(x, y).Interior.ColorIndex = xlNone
    > Cells(x, y).Interior.Pattern = myPatter
    > End If
    >
    > jayklmno wrote:
    > > I am having issues with the cell color changing and updating, and removing
    > > pattern information in the same cell.
    > >
    > > I need to look through a data and color it a certain color and when the data
    > > is revised, I uncolor it. Users have added patterns to denote other stuff and
    > > the remove color as desribed below, also removes the pattern. Is there a way
    > > to remove the color and retain the pattern?
    > >
    > > If Cells(x, y).Interior.ColorIndex = 8 Then
    > > Cells(x, y).Interior.ColorIndex = xlNone
    > > End If
    > >
    > > Thanks,
    > > Jay

    >
    >


  5. #5
    Trevor Shuttleworth
    Guest

    Re: Clear color but not pattern?

    Something like:

    With Selection.Interior
    sPattern = .Pattern
    sPatternIndex = .PatternColorIndex
    .ColorIndex = xlNone
    .Pattern = sPattern
    .PatternColorIndex = sPatternIndex
    End With

    So:

    If Cells(x, y).Interior.ColorIndex = 8 Then
    With Cells(x, y).Interior
    sPattern = .Pattern
    sPatternIndex = .PatternColorIndex
    .ColorIndex = xlNone
    .Pattern = sPattern
    .PatternColorIndex = sPatternIndex
    End With
    End If

    Regards

    Trevor


    "jayklmno" <jayklmno@discussions.microsoft.com> wrote in message
    news:C83AEFCB-E202-45C1-AF5D-28367337E794@microsoft.com...
    >I am having issues with the cell color changing and updating, and removing
    > pattern information in the same cell.
    >
    > I need to look through a data and color it a certain color and when the
    > data
    > is revised, I uncolor it. Users have added patterns to denote other stuff
    > and
    > the remove color as desribed below, also removes the pattern. Is there a
    > way
    > to remove the color and retain the pattern?
    >
    > If Cells(x, y).Interior.ColorIndex = 8 Then
    > Cells(x, y).Interior.ColorIndex = xlNone
    > End If
    >
    > Thanks,
    > Jay




+ 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