Hey guys....I hope you are still there...!!
You, first, Charles....
I Rt-clicked the sheet tab for Sheet1 one of my spreadsheet and entered your VBA. (I added the missing "L" in this line of your code, first):
Dim cel As Range, mcell As Range, fcell As Range, male As Range, female As Range
Next, I ran the VBA...and everything seemed to work flawlessly.
Sheet1 quickly became a grid of GREEN and RED cells...(with a few unformatted cells for names not found in either list).
I wanted to test the VBA by entering a few names, and deleting a few names from both MALE and FEMALE ranges on Sheet2. After doing so, I clicked back to Sheet1 to see if the cell formatting had changed. It had NOT!!! The cells were the SAME color as they were after I initially ran the Sub. So, I went to Sheet2, and deleted the ENTIRE list of names in the MALE range. I expected that there would be NO FORMATTING in the cells containing MALE names....but there was!!! In fact, the formatting had not changed in ANY of the cells on Sheet1.
Also, I have a macro that sorts Sheet1 alphabetically. After running this macro, all cells retained the formatting from the original sortation. (Meaning...if cell A1 had been formatted GREEN, it remained GREEN even if the name in that cell had changed to a FEMALE name.
At this point, I figured that I must be doing something wrong. I began to assume that I needed some kind of event to trigger this VBA, but I had no clue how to trigger it. In an attempt to get Sheet1 freshly formatted, I opened the VBE and triggered the VBA from there.
This time....
....I got an error message:
Run-time error '1004':
Application-defined or object-defined error
What am I doing wrong, here.....???
daddylonglegs,
Yes, some of the cells in the MALE and FEMALE ranges are "formula blanks".
As I mentioned earlier...I initially had formulas identical to yours as Condition 1 and Condition 2 of my conditional formatting. This meant that any BLANK cells in the conditionally formatted range would turn RED...because they were meeting Condition 1.
I changed the formulas in the manner that you suggested:
=COUNTIF(Male,A1)*(A1<>"")
And when I clicked OK....NOT ONE of the cells on Sheet1 was formatted...!!!
And furthermore, when I tried to return to the original formulas...(get this...!!!)...there was STILL NO FORMATTING on Sheet1. And now, for some reason or other...I can't even get those OLD conditional formats to work.
What could possibly be the problem...???
Bookmarks