I'll dissect the code with comments to see if that helps, but this is not
real beginner stuff, but it is also not that complex.
Afraid it cannot be simplified in the way you describe, but you should find
all of the bits in Help.
D.Parker said:
Bob:
Thank you very much. Being that I am a beginner/novice user I was unable to
find any information on the syntax "Me.Range". How is this used? Also the
"Case 3:", does that imply if red then go to blue. The code works well, but
I don't understand all the variable names and code movement (i.e. Not
Intersect...Is Nothing). Or is there a beginner version of this code you
have written (meaning all items will either be mentioned in the Help menu or
a textbook). Thank you.
Kind regards,
D.Parker
This is worksheet event code that will be triggered every time a cell, or
cells, is selected. The selected cell(s) is passed to the event macro as the
Target argument
Not necessary, throw-back to some other code.
Routine error handling, to force us out on an error
Disabel events so that our code doe not trigger other events.
This tests whether the range that we are monitoring, A1:H10 intersects with
the Target range passed as the argument to the event macro. This is a way of
determining whether the range we are monitorintg has been selected. If not,
we just bypass the next set of code.
Sets a reference to an object so that all subsequent . (dot) references
implicitly refer to this object type, cuts down on typingt, is more
efficient and more readable
Initiate a Case statement on the colorindex value of the Target cell, that
is the selected cell. This is equivalent to a nested If ... ElseIf ... End
If statement
If the current cell colorindex is 3 (red) set it to 5 (blue)
If the current cell colorindex is 5 (blue) set it to 6 (yellow)
If the current cell colorindex is 6 (yellow) set it to 10 (green)
Any other value, including no colour set to 3 (red)
Tidy up tand end he Select and With statements
Select A1, so that we can re-select the same cell again.
Reset events. This is i the error clause, so that if we get an error, we
always divert here, and always reset events.