+ Reply to Thread
Results 1 to 2 of 2

Restrict Which Cell Fill Colours Can Be Used

  1. #1
    Registered User
    Join Date
    10-15-2018
    Location
    London, England
    MS-Off Ver
    210
    Posts
    43

    Restrict Which Cell Fill Colours Can Be Used

    Hello everyone,

    I am looking for a VBA script to restrict which cell fill colours can be used. For example only 6 (pre-chosen) colours are available to the user on 1 particular workbook across all worksheets.

    As I am currently using a custom VBA formula that counts cell fill colours and users keep using different shades of said colours and therefore the formula does not count all the relevant cells. Custom formula below...




    Function CountColorIf(rSample As Range, rArea As Range) As Long

    Application.Volatile

    Dim rAreaCell As Range
    Dim lMatchColor As Long
    Dim lCounter As Long

    lMatchColor = rSample.Interior.Color
    For Each rAreaCell In rArea
    If rAreaCell.Interior.Color = lMatchColor Then
    lCounter = lCounter + 1
    End If
    Next rAreaCell
    CountColorIf = lCounter

    End Function

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,594

    Re: Restrict Which Cell Fill Colours Can Be Used

    Hi there,

    This seems like an interesting (if unusual) requirement!

    After reading quickly through the information on this page:


    it seems that you might be able to use this approach to specify duplicate colour values for several of the 56 ColorIndex Colours available to the User, and thereby make only six unique colours available.


    Hope this is of some help/interest.

    Regards,

    Greg M

+ 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. [SOLVED] Excel Cell Fill Colours
    By mikekelly1978 in forum Excel General
    Replies: 5
    Last Post: 05-30-2019, 08:15 AM
  2. [SOLVED] How do I set up conditional cell fill colours in Excel?
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 PM
  3. How do I set up conditional cell fill colours in Excel?
    By Naomi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  4. How do I set up conditional cell fill colours in Excel?
    By Naomi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  5. [SOLVED] How do I set up conditional cell fill colours in Excel?
    By Naomi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  6. How do I set up conditional cell fill colours in Excel?
    By Naomi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  7. How do I set up conditional cell fill colours in Excel?
    By Naomi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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