So, it’s a new week, and I’ve got new ideas for improving things. Part of what I do is send out reports to individual offices and departments all over the place; these offices in turn are supposed to go through the information and note inconsistencies. As with everything in life, this turns out to be more trouble than anything else. In an effort to make it a little bit more painless (I hope) I want to try somethinga little different for them. What I would like to do is set up something within the worksheet that the individuals receive that does two things:
- First, I would like to set up the worksheet so that when the user
clicks on a cell the cell is highlighted; - Second, after the cell highlights then the activebox would
automatically transfer to a “comments” box at the end of the row
where the user would enter their comments as to why the cell in
question was highlighted; and - Third, assuming that someone will make a mistake and highlight
something by mistake I would like to add the additional function
that if a user selects a cell that is highlighted then it would
clear the highlight from the cell.
Possible? Suggestions? Thanks!
JMax is correct in identifying the flaw in that you cannot edit a cell if it changes color and selects a comments cell every time you click on it. The best way around this problem is to change the color only on double-click. I would also define the selected row/column and see if they fall within a table’s range (instead of using Application.Intersect) but that’s just personal preference
Something like…
Note that we disable events so no other code can be triggered by us selecting a different cell. This is an absolute necessity when implementing the Worksheet_SelectionChange event, less so with the BeforeDoubleClick event
It’s very important to consider how you trigger macros and how they give the user flexibility. This Excel help video provides a reasonable introduction