Peter
thanks for that exhaustive explanation. I have copied the code into the appropriate place and added the myMacro process to that code, rather than calling the macro, which was only putting "VOID" into the next 15 cells on the same row, so adding a line of code to your code seems sensible.This all seems to work perfectly
The code I have used is
Code:
Range(activecell.Offset(-1, 1), activecell.Offset(-1, 15)) = "VOID"
The only column in which "VOID" would be entered is column B so any direction you could give with that in mind would be welcome.
Thanks for all your time
Robert
Robert
Putting a single line of code into the event code makes sense to me. However, not the particular line you have used as again it is not robust. Using ActiveCell is dangerous in this citcumstance. Dangerous in terms of not getting the result you want I mean.
I think you have written it on the basis that 'VOID' would be entered in a single cell and confirmed by pressing Enter, moving the active cell down one row. However, that is not the only way to enter values. With that line still in place, try these ..
a) Select B30 and type VOID but confirm with the Tab key, not Enter.
b) Select B33 and type VOID follwed by the up arrow, not the Enter key.
c) Select B34 and type VOID, don't press the Enter key but select cell E40 with the mouse.
d) Select B33:B34 (both cell should contain VOID from b & c above, copy them. Select cell B43 and Paste.
Now try replacing that line of code with
Code:
rCell.Offset(, 1).Resize(, 15).Value = "VOID"
Consider removing the all values generated with the above examples and try repeating the exercises.
Now to focus on column B, here is some new code. After replacing the old code with this, try entering VOID in different ways in column B and also try entering VOID in other columns just to confirm that nothing happens in that case.
<font face=Courier New><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)<br> <SPAN style="color:#00007F">Dim</SPAN> rCell <SPAN style="color:#00007F">As</SPAN> Range, Changed <SPAN style="color:#00007F">As</SPAN> Range<br> <br> <SPAN style="color:#00007F">Set</SPAN> Changed = Intersect(Target, Columns("B"))<br> <br> <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> Changed <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> Application.EnableEvents = <SPAN style="color:#00007F">False</SPAN><br> <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> rCell <SPAN style="color:#00007F">In</SPAN> Changed <SPAN style="color:#007F00">'<- Note this line has changed as well</SPAN><br> <SPAN style="color:#00007F">If</SPAN> UCase(rCell.Value) = "VOID" <SPAN style="color:#00007F">Then</SPAN><br> rCell.Offset(, 1).Resize(, 15).Value = "VOID"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">Next</SPAN> rCell<br> Application.EnableEvents = <SPAN style="color:#00007F">True</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>