+ Reply to Thread
Results 1 to 5 of 5

Macro to validate a condition and change cell color

  1. #1
    Registered User
    Join Date
    07-09-2010
    Location
    Delhi NCR, India
    MS-Off Ver
    Excel 2003
    Posts
    46

    Macro to validate a condition and change cell color

    Hi,

    Can someone help me with the below code. I want the macro to validate the following two conditions and if both the the conditions are met it should change the cell color format to White.

    Conditions are:
    1. If Cel.Interior.ColorIndex = 50
    2. And If Cel.Value is Not Equal to "(blank)"

    Then it should change the Cell Color to White. I have written the following code but its not working. Please help. Thanks.

    Please Login or Register  to view this content.
    Last edited by kapil; 08-03-2010 at 10:10 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro to validate a condition and change cell color

    Try:
    Please Login or Register  to view this content.
    I might have been too hasty - are you actually checking for the text string "(blank)"? If the latter then try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-09-2010
    Location
    Delhi NCR, India
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Macro to validate a condition and change cell color

    Thanks StephenR.

    But in my sheet, cell has a text written in this format --- "(blank)"

    i.e. my cell is not empty, it has text in it.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro to validate a condition and change cell color

    Have you tried the second suggestion? Do the cell contents include the quotes too?

  5. #5
    Registered User
    Join Date
    07-09-2010
    Location
    Delhi NCR, India
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Macro to validate a condition and change cell color

    Oh Great... Perfect... Thanks Stephen... your second code works perfectly fine.

+ 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