+ Reply to Thread
Results 1 to 5 of 5

Adapt code to include "number" and colour formatting

  1. #1
    Registered User
    Join Date
    03-22-2010
    Location
    London
    MS-Off Ver
    2007
    Posts
    49

    Lightbulb Adapt code to include "number" and colour formatting

    Hi all,

    I have a piece of code (with the help of forum member Marcol) that formats a column of cells based on the values in columns G and H. (see below)

    I have to now add a numeric value to the coloured cells in column I, such that:
    - when RGB(142,42,160) in I, value in cell = 4
    - when RGB(0, 32, 96) in I, value in cell = 3
    - when RGB(64, 224, 208) in I, value in cell = 2
    - when RGB(255, 255, 255) in I, value in cell = 1


    Please Login or Register  to view this content.
    I'd be grateful if someone could help me adapt the above.

    Many thanks!

    DP
    Last edited by dpcp; 08-22-2011 at 07:11 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Adapt code to include "number" and colour formatting

    If you analyse the code very carefully, it is very easy for you to adapt it with your new requirement.

    While analysing you could simplify the code to:

    Please Login or Register  to view this content.
    Last edited by snb; 08-22-2011 at 05:22 AM.



  3. #3
    Registered User
    Join Date
    03-22-2010
    Location
    London
    MS-Off Ver
    2007
    Posts
    49

    Re: Adapt code to include "number" and colour formatting

    Hi snb

    Thanks for your message!

    I tried to use the simplified code you provided but unfortunately when I added further code to set the cell values, the values were not showing up in the column.

    However, I did adapt my original code to the following:

    Please Login or Register  to view this content.
    And that works.

    Many thanks for your help, otherwise I would not have had my 'brainwave' without it!

    DP

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Adapt code to include "number" and colour formatting

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-22-2010
    Location
    London
    MS-Off Ver
    2007
    Posts
    49

    Re: Adapt code to include "number" and colour formatting

    Ah... I see... good point!

    Many thanks again

    DP

+ 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