+ Reply to Thread
Results 1 to 5 of 5

Positive cells taking a zero value

  1. #1
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184

    Positive cells taking a zero value

    I have a code below to only allow a number to be entered into one of 2 cells. I'm trying to do conditional formatting based on these to cells, and the evidence is showing that even when I type a value into either I21 or I22, they are taking on a value of zero. I have conditional formatting stating that if I21>0, then do one thing. And in a separate cell, I have =I22>0, then do another thing. Neither works, and even using =I22<>0, then do formatting, and it doesn't work, telling me that the assumed value is always zero. Any ideas of why, or how to work around this?

    Please Login or Register  to view this content.
    Last edited by jman0707; 11-05-2008 at 02:02 PM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    I reduced the code down to

    Please Login or Register  to view this content.
    but I am not clear what you are trying to do, this code locks all cells.

  3. #3
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184
    The problem I was having is that with the code I'm using, if one of the cells had a positive number in it, conditional formatting still thought that it had a zero value. In conditional formatting I'd put =I22>0 and put the formatting I want, and no matter if it held a zero value or a number, it wouldn't format. So my thoughts were that it had to do with the macro controlling the cells and not the cells itself. Conditional formatting works for the rest of the worksheet.

    What I need from the code (which works now) is for them both to be unlocked. If either takes a value >0, the other locks, but the cell > 0 remains unlocked. The locked cell won't unlock until a value of 0 is entered into the unlocked one with the positive value. Then they are both unlocked again. I was just wondering if anything in my code was indicative of screwing up conditional formatting. Any thoughts?

  4. #4
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184
    The formatting works on I22 and I21, they format based on each other, but I can't get other cells in the worksheet to format based on their values. I'm clicking on another cell, typing in =$I$22>0 and filling out the formatting info, but it doesn't work. I've even tried going to the rule in I21 and I22 and applying them to other cells, and that doesn't work either. I have other cells in the sheet formatting based on other cells besides themselves, so i don't know why it's not working.......

  5. #5
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184
    One of the cells started to work, but the other didn't. I have no clue what's messing it up, it's probably either the sheet protection or macros. But anyway, I opted to use a formula in the cell instead of conditional formatting. So I put =if(I21>0,"","Text") for the text I wanted. I had previously just tried to use conditional formatting to change the font color to the same as the background to make it disappear. So I still don't know why that doesn't work.......

+ 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