+ Reply to Thread
Results 1 to 6 of 6

Change cell background color if cell is empty?

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Change cell background color if cell is empty?

    I want to change the background color of the cell to red if the user has not entered a value in the cell NewPrice. Once the user starts to type a value in NewPrice, I would like the background color to change to white? The 2nd line of my code does not work?


    Please Login or Register  to view this content.
    Thanks in advance

  2. #2
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Change cell background color if cell is empty?

    if I can get the 2nd line correct, I think I can use the "Change Event" to change the background color back to white?

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Change cell background color if cell is empty?

    Quote Originally Posted by Aland2929 View Post
    The 2nd line of my code does not work?


    Please Login or Register  to view this content.

    That's the correct syntax. Does it throw an error? Do you have a named range called NewPrice (check spelling)? Is the cell truly empty?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Change cell background color if cell is empty?

    Thanks for your reply. I have a range name NewPrice and spelling is correct. The error message is:
    Run-time error '1004':
    Application-defined or object defined error

  5. #5
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Change cell background color if cell is empty?

    I changed the 2nd line of code but still receive the same Run-time error '1004': Application-defined or object defined error

    Please Login or Register  to view this content.
    Thanks in advance.

  6. #6
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Change cell background color if cell is empty?

    The sheet I am working on was a protected sheet. I unprotected the sheet & then it worked. Thanks for your assistance.

+ 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: 8
    Last Post: 04-02-2016, 04:00 AM
  2. [SOLVED] Changing an empty cell's background color depending on a different cell value.
    By Excell4Dummies in forum Excel General
    Replies: 6
    Last Post: 08-07-2014, 04:10 PM
  3. Change a Range's cell background color to that of another cell's cond. format color
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2014, 12:57 PM
  4. Change cell background color based on another cells background color
    By Queo in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 06-10-2014, 05:28 AM
  5. [SOLVED] Change background color of cell if previous column cell value is different.
    By abhinavbinkar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2014, 08:25 AM
  6. Replies: 1
    Last Post: 10-23-2012, 03:58 PM
  7. Change cell background color depending on cell value
    By fredrock80 in forum Excel General
    Replies: 1
    Last Post: 03-14-2005, 03:22 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