+ Reply to Thread
Results 1 to 9 of 9

Changing Cell colours

  1. #1
    Registered User
    Join Date
    03-04-2008
    Posts
    32

    Changing Cell colours

    I am trying to change the colour of a cell based on the colour of the cell in another worksheet. ie

    Sheet 1 cell b3 = green therefore sheet 2 cell d5 should also be green.

    Any help

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning johncon

    ...and welcome to the forum!!

    What version of Excel do you have?

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    03-04-2008
    Posts
    32
    Thanks for the quick reply.
    I am using Excel 2000

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Excel 2000 has no colour functions. You could write a User Defined Function to get the ColorIndex of a cell. You would then ned to use Conditional formattig to colour the cell based n the result because a function cannot affect a cell.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi johncon

    OK - it can be done but you're breaking a few of Excels rules here, so it's not a straightforward question.

    Using conditional formatting you can't use it across worksheets, and Excel2000 doesn't have a function to detect cell colours (not invented till Excel 2007) so we'll have to put our own in. First we'll tackle the cell colours bit - either use the one from here under Return the ColorIndex of a Cell:
    http://www.cpearson.com/excel/colors.htm
    or you can download my add-in from the link below, and once installed go to Ultimate > Formulae > Add Function, select Cell Colour from the list and click Add Function. This will add the necessary code to your workbook.

    Now the cell that you want to test for a colour (let's say cell A1 on Sheet1) needs to be set up as a named range. So select the cell, go to Insert > Name > Define, type a name into the box (I've used "myname") and click Add and OK.

    In a spare cell on Sheet1 type the formula:
    =CellColour(A1)
    This formula will be different if you used Chip Pearson's function.
    This will give you the ColorIndex of the cell - I've used loud yellow - ColorIndex 6.
    Now go to your other sheet (Sheet2) and in the cell that has to reflect the colour go to Format > Conditional Formatting, select Formula Is and put this formula in the box :
    =CellColour(myname)=6
    and select your format.

    Phew! It's a bit of a trek, but it does work.

    HTH

    DominicB

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Her's a quick example. See the formula 7 Conditional Formatting of E3 in Sheet1 7 G3 in Sheet2
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-04-2008
    Posts
    32
    Many thanks for the reply, but conditional formatting does not help as you can only have 3 of them.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You didn't say that you would have more than one cell or colour! You can adapt the suggestions with VBA but how many conditions would you have?

  9. #9
    Registered User
    Join Date
    03-04-2008
    Posts
    32
    Thre would be about 20-30 per worksheet.

    I think that this can be done either by the If or select statement but not sure

+ 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