+ Reply to Thread
Results 1 to 11 of 11

How to remove cell pattern and keep cell background color

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    How to remove cell pattern and keep cell background color

    Hello,

    when I use in my code:

    Please Login or Register  to view this content.
    it adds pattern and KEEPS BACKGROUND COLOR of modified cells. OK...

    But when I use in my code:

    Please Login or Register  to view this content.
    It removes the pattern but IT ALSO REMOVES BACKGROUND COLOR. Which is not OK for me.

    MANUALLY, via cell properties, IT IS POSSIBLE to remove pattern and keep background color by selecting top-left pattern style.
    Is there such solution for VBA?
    Thanks for your replies.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,324

    Re: How to remove cell pattern and keep cell background color

    You need Color as opposed to PatternColor.

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Re: How to remove cell pattern and keep cell background color

    Ok, to be more specific: I have following very simple (quickly written) "enhancement" macro to help me with orientation in Excel sheets:

    Please Login or Register  to view this content.
    which works fine until I start to use workbooks with colored cells (which is not so often in case of "data-output workbooks" compared to "office workbooks", but...). If you test it, it will make my needs clear.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,324

    Re: How to remove cell pattern and keep cell background color

    If you test it, it will make my needs clear.

    Test it with what? You want me to create a workbook, put the code in, guess at what steps you go through to colour some cells and then see if I can break it. I don't think so.

  5. #5
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Re: How to remove cell pattern and keep cell background color

    OK, I don't want you to do anything. I just would like you or anyone to answer my unsolved question:

    Is it possible to remove cell pattern by a simple instruction and to keep (formerly set) cell background color?

    Regards.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,324

    Re: How to remove cell pattern and keep cell background color

    Short answer would appear to be "no".

    I've asked for others to take a look.

  7. #7
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Re: How to remove cell pattern and keep cell background color

    I know, therefore easy quick solution with borders (for workbooks, where borders are not used):

    Please Login or Register  to view this content.
    Bye and thanks.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,324

    Re: How to remove cell pattern and keep cell background color

    It has been suggest that you use Conditional Formatting rather than pure VBA. You will, however, still need a small piece of code to enable the functionality.

    See the solution suggested here:

    http://www.tushar-mehta.com/publish_...d%20cell.shtml


    Regards, TMS

  9. #9
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Re: How to remove cell pattern and keep cell background color

    Also interesting. Thanks. But I have to move on in my work... my solution is for me enough (followed by easy code to remove all borders from workbook on closing...)

    Regards.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,324

    Re: How to remove cell pattern and keep cell background color

    As you wish. Good solution provided you don't use borders in your workbook. Which I guess you don't otherwise you'll probably face the same problem over again

  11. #11
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Re: How to remove cell pattern and keep cell background color

    (It is being used only in workbooks without any formatting (prg output data, originally as CSV) and cells in these wbks are already conditionally formated (highlighting of deviations for further presentation as pre-analysis). And browsing through such excels at 50% zoom on 24" high-res LCD is sometimes little bit difficult, when I try to find and visually compare corresponding data on the same row or in the same column - there are approx.70 columns and xx000 rows. Therefore I added 2 lines to the code above making the borders red...).

    OK, the thread solved for me.
    Best regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 12-29-2013, 11:41 PM
  2. Replies: 2
    Last Post: 02-25-2013, 03:36 AM
  3. Replies: 6
    Last Post: 11-07-2012, 10:46 AM
  4. Replies: 4
    Last Post: 09-15-2012, 02:46 PM
  5. Replies: 1
    Last Post: 10-28-2005, 12:05 PM

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