Link to home
Start Free TrialLog in
Avatar of Pedro
Pedro

asked on

Edit coloring based on B3:G3 selection

The attached file is the one to be edited or you can write your own script.

I highlighted B3:F3 and it colors the number in G3 even though it is not highlighted. The idea is to search for and color only the selected columns since I did not select G3 I do not want that number colored in when it is found. I hope that clarifies things.

The idea is to automatically only color the selected numbers.
Copy-of-GroupColoring.xlsm
Avatar of Norie
Norie

Doesn't happen when I run the code.
Avatar of Pedro

ASKER

What doesn't happen?

When you run the code it should prompt you to make a selection. Select cells B3:G5, for example and it should color cells that match numbers in B3:G3.
You said select B3:F3, not B3:G3, so that's what I did.

I thought the problem was that G3 was being coloured when ''I did not select G3'?
Avatar of Pedro

ASKER

The idea is that I would like to 'change' the script. So that it does NOT color G3 when that position is not chosen. Currently it colors it even though it is not part of the selection.
I agree with imnorie: the code is working for me just the way that you say it ought to. In other words, if I select B3:F3 in response to the InputBox, then cell G3 does not get colored.
Avatar of Pedro

ASKER

While it is true that Cell G3 does not get colored, please note that you must choose far enough down to select the 'number' in cell G3 to see the result. Therefore, select down to cell B3:F18 and you will see that number 14 gets colored which is the number contained in cell G3.

The point of this is that if the selection does not include G3 then that number should not get colored in. Therefore, a modification of the original script is needed to accomplish this.
As written, your macro puts the values in cells B3:G3 into a Dictionary. This range is fixed in the code. The macro then asks for the user to select some cells. Any value in the selected range that is also in the Dictionary will be colored.

If you want something different to happen, you will need to describe exactly how it should work. Based on your latest Comment, it is not clear what cells should go in the Dictionary.
SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pedro

ASKER

Byundt and The_Barman,

I must say both of you did an excellent job.

The_Barman, you actually went above and beyond the call of duty. You deserve a medal of honor for actually making the job of clearing cells after they're used so much easier, and I specially like the fact that I can select a different set of cells in the process.

P.S. I do hope you're both satisfied about splitting the points in this case. If there is another viable solution, I am all ears. Again, Thank you for a job well done.
You are welcome

Please do not worry about the splitting of points...
I am always far happier with the words of thanks and knowing you have a good answer.